Ext.ns("Application.controllers.comModule"); Application.controllers.comModule.ApplicController=Ext.extend(Application.controllers.Abstract,{title:"\u0417\u0430\u044f\u0432\u043a\u0438",createAction:function(params,app,panel){panel.add({xtype:"Application.components.actionPanel",cmpType:"Application.components.ApplicForm",cmpParams:{lot_id:params.lot,procedure_id:params.procedure,application_id:null,noneditable:false,additional:params.additional=="true",stage:params.stage},title:"\u0417\u0430\u044f\u0432\u043a\u0430 \u043d\u0430 \u0443\u0447\u0430\u0441\u0442\u0438\u0435 \u0432 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435",cls:"cleanborder", forceHeader:true})},createbyprocedureAction:function(params,app,panel){RPC.Procedure.load(params.procedure,function(resp){if(resp.success){if(resp.procedure&&resp.procedure.lots){var lot_id=resp.procedure.lots[0].id;panel.add({xtype:"Application.components.actionPanel",cmpType:"Application.components.ApplicForm",cmpParams:{lot_id:lot_id,procedure_id:params.procedure,application_id:null,noneditable:false},title:"\u0417\u0430\u044f\u0432\u043a\u0430 \u043d\u0430 \u0443\u0447\u0430\u0441\u0442\u0438\u0435 \u0432 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435", cls:"cleanborder",forceHeader:true});panel.doLayout()}}else redirect_to("com/procedure/index")})},editAction:function(params,app,panel){panel.add({xtype:"Application.components.actionPanel",cmpType:"Application.components.ApplicForm",cmpParams:{lot_id:params.lot,procedure_id:params.procedure,application_id:params.application_id,noneditable:false},title:"\u0417\u0430\u044f\u0432\u043a\u0430 \u043d\u0430 \u0443\u0447\u0430\u0441\u0442\u0438\u0435 \u0432 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435", cls:"cleanborder",forceHeader:true})},signAction:function(params,app,panel){var additionalFields=[];additionalFields.push({nm:"application_id",val:params.application_id});panel.add({xtype:"Application.components.actionPanel",cmpType:"Application.components.SignatureForm",cmpParams:{backUrl:"com/applic/create/procedure/"+params.procedure+"/lot/"+params.lot+(params.additional?"/additional/"+params.additional:""),additional:additionalFields,useFormHandler:false,api:RPC.Applic.sign,success_fn:function(resp){RPC.Index.serverinfo(function(response){if(response.success&& response.contragent){Main.contragent.available_sum=parsePrice(response.contragent.available_sum);Main.contragent.available_credit_sum=parsePrice(response.contragent.available_credit_sum);Main.app.fireEvent("available_sum_changed",Main.contragent.available_sum,Main.contragent.available_credit_sum)}});redirect_to(resp.redirect_url)}},listeners:{afterrender:function(){var values={};values.application_id=params.application_id;values.procedure_id=params.procedure;values.for_sign=true;RPC.Applic.loaddraft(values, function(provider,resp){if(resp.result.success){var p={};var isPP26=false;if(resp.result.applic.procedure.procedure_type==PROCEDURE_TYPE_AUC_ASC_26){p.pp26=true;isPP26=true}p.procedure_id=resp.result.applic.procedure.id;p.contragent_type=Main.contragent.supplier_profile_id!=SUPPLIER_TYPE_FIZ_RF&&Main.contragent.supplier_profile_id!=SUPPLIER_TYPE_FIZ_FOREIGN?"fizik":"urik";performRPCCall(RPC.Reference.getApplicationText,[p],null,function(r){var ap_text="";if(!resp.result.applic.customer_agree_form)ap_text= r.application_text;Ext.apply(resp.result.applic,{applic_text:ap_text});try{var tpl=getApplicSignatureTemplate(isPP26?3:params.totalParts,resp.result.applic.procedure.procedure_type,!!resp.result.applic["multiply_suppliers"]);var signature_text=tpl.applyTemplate(resp.result.applic);Ext.getCmp("signature_text").setValue(signature_text)}catch(err){logException(err);alertError("\u041f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u0430 \u043e\u0448\u0438\u0431\u043a\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0442\u0435\u043a\u0441\u0442\u0430 \u0434\u043b\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u044f"); console.log(err)}})}else Ext.MessageBox.alert("\u041e\u0448\u0438\u0431\u043a\u0430",resp.result.message)})}}})},listAction:function(params,app,panel){panel.add({xtype:"Application.components.fullscreenPanel",cmpType:"Application.components.ApplicGrid",title:"\u041c\u043e\u0438 \u0437\u0430\u044f\u0432\u043a\u0438",cmpParams:{directFn:RPC.Applic.index,companyType:"my"}})},procslistAction:function(params,app,panel){var cmpTitle="\u0417\u0430\u044f\u0432\u043a\u0438 \u043d\u0430 \u043c\u043e\u0438 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b"; if(typeof params.procedure_id!=="undefined")cmpTitle="\u0421\u043f\u0438\u0441\u043e\u043a \u0437\u0430\u044f\u0432\u043e\u043a \u043d\u0430 \u0443\u0447\u0430\u0441\u0442\u0438\u0435 \u0432 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435";panel.add({xtype:"Application.components.fullscreenPanel",cmpType:"Application.components.ApplicGrid",title:cmpTitle,cmpParams:{directFn:RPC.Applic.index,procedureId:params.procedure_id}})},cancelAction:function(params,app,panel){var additionalFields=[]; additionalFields.push({nm:"application_id",val:params.id});panel.add({xtype:"Application.components.actionPanel",cmpType:"Application.components.SignatureForm",cmpParams:{backUrl:"com/applic/list/type/my",additional:additionalFields,useFormHandler:false,api:RPC.Applic.cancel,success_fn:function(resp){RPC.Index.serverinfo(function(response){if(response.success&&response.contragent){Main.contragent.available_sum=parsePrice(response.contragent.available_sum);Main.contragent.available_credit_sum=parsePrice(response.contragent.available_credit_sum); Main.app.fireEvent("available_sum_changed",Main.contragent.available_sum,Main.contragent.available_credit_sum)}});redirect_to(resp.redirect_url)}},listeners:{afterrender:function(){RPC.Reference.getApplicationCancelText(params.id,function(provider,resp){if(resp.result.success){var applic_text=resp.result.applic_text;Ext.getCmp("signature_text").setValue(applic_text)}else Ext.MessageBox.alert("\u041e\u0448\u0438\u0431\u043a\u0430",resp.result.message)})}}})},deleteAction:function(params,app,panel){var additionalFields= [];additionalFields.push({nm:"application_id",val:params.id});panel.add({xtype:"Application.components.actionPanel",cmpType:"Application.components.SignatureForm",cmpParams:{backUrl:"com/applic/list/type/my",additional:additionalFields,useFormHandler:false,api:RPC.Applic.remove},listeners:{afterrender:function(){RPC.Applic.loaddraft(params.id,function(provider,resp){if(resp.result.success){var applic=resp.result.applic;var signature_text="\u0417\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044c \u00ab"+ applic.supplier.full_name+"\u00bb \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u0447\u0435\u0440\u043d\u043e\u0432\u0438\u043a \u0437\u0430\u044f\u0432\u043a\u0438."+"\n"+"\u0420\u0435\u0435\u0441\u0442\u0440\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b: "+applic.procedure.registry_number+"\n"+"\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b: "+applic.procedure.title+"\n"+"\u0414\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043c\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0447\u0435\u0440\u043d\u043e\u0432\u0438\u043a\u0430 \u0437\u0430\u044f\u0432\u043a\u0438: "+ Ext.util.Format.date(new Date,"d.m.Y H:i");Ext.getCmp("signature_text").setValue(signature_text)}else Ext.MessageBox.alert("\u041e\u0448\u0438\u0431\u043a\u0430",resp.result.message)})}}})},viewAction:function(params,app,panel){panel.add({xtype:"Application.components.actionPanel",title:"\u0417\u0430\u044f\u0432\u043a\u0430 \u043d\u0430 \u0443\u0447\u0430\u0441\u0442\u0438\u0435 \u0432 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435",cmpType:"Application.components.ApplicForm",forceHeader:true, cmpParams:{noneditable:true,title:"\u0417\u0430\u044f\u0432\u043a\u0430 \u043d\u0430 \u0443\u0447\u0430\u0441\u0442\u0438\u0435 \u0432 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435",mode:"view",hideTitle:false,application_id:params.id,lot_id:params.lot_id,filter:params.filter,original:params.original||false}})},reviewAction:function(params,app,panel){panel.add({xtype:"Application.components.actionPanel",cmpType:"Application.components.applicationsReviewForm",cmpParams:{stage:params.stage, lot_id:params.lot,procedure_id:params.procedure,act:params.act||""}})},openapplicsAction:function(params,app,panel){panel.add({xtype:"Application.components.actionPanel",cmpType:"Application.components.applicationsOpeningForm",title:"\u0412\u0441\u043a\u0440\u044b\u0442\u0438\u0435 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u043e\u0432 \u0441 \u0437\u0430\u044f\u0432\u043a\u0430\u043c\u0438",cmpParams:{stage:parseInt(params.stage),lot_id:params.lot,procedure_id:params.procedure,act:params.act||""}})}, viewapplicsAction:function(params,app,panel){panel.add({xtype:"Application.components.actionPanel",cmpType:"Application.components.applicationsViewForm",cmpParams:{lot_id:params.lot,filter:params.filter}})},showAllApplicAction:function(params,app,panel){var additionalFields=[];additionalFields.push({nm:"lot_id",val:params.lot});panel.add({xtype:"Application.components.actionPanel",cmpType:"Application.components.SignatureForm",cmpParams:{backUrl:"com/protocol/signprotocol/lot/"+params.lot+"/stage/2/showall/1", additional:additionalFields,useFormHandler:false,api:RPC.Applic.saveShowAllMode},listeners:{afterrender:function(){var values={};values.lot_id=params.lot;RPC.Applic.getShowAllApplicText(values,function(provider,resp){if(resp.result.success)Ext.getCmp("signature_text").setValue(resp.result.text_showall);else echoResponseMessage(resp)})}}})},makeintentionAction:function(params,app,panel){panel.add({xtype:"Application.components.actionPanel",cmpType:"Application.components.IntentionForm",title:"\u041f\u043e\u0434\u0430\u0447\u0430 \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u043e\u0431 \u0443\u0447\u0430\u0441\u0442\u0438\u0438 \u0432 \u0437\u0430\u043a\u0443\u043f\u043a\u0435", cmpParams:{lot_id:params.lot,procedure_id:params.procedure}})},signintentionAction:function(params,app,panel){var additionalFields=[];additionalFields.push({nm:"lot_id",val:params.lot});additionalFields.push({nm:"procedure_id",val:params.procedure});panel.add({xtype:"Application.components.actionPanel",cmpType:"Application.components.SignatureForm",cmpParams:{backUrl:"com/applic/makeintention/procedure/"+params.procedure+"/lot/"+params.lot,additional:additionalFields,useFormHandler:false,api:RPC.Applic.signintention, success_fn:function(resp){redirect_to("com/procedure/index")}},listeners:{afterrender:function(){performRPCCall(RPC.Lot.load,[{lot_id:params.lot}],{wait_text:"\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e \u0437\u0430\u043a\u0443\u043f\u043a\u0435."},function(resp){if(resp.success){var intention_text="\u041d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u043c \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u043c \u043e \u0441\u0432\u043e\u0435\u043c \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u0438\u0438 \u043f\u0440\u0438\u043d\u044f\u0442\u044c \u0443\u0447\u0430\u0441\u0442\u0438\u0435 \u0432 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u043a\u0443\u043f\u043e\u0447\u043d\u043e\u0439 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435. \u041f\u043e\u0434\u0430\u0447\u0430 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043d\u0435 \u043e\u0431\u044f\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430\u0441 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0443\u0447\u0430\u0441\u0442\u0438\u0435 \u0432 \u0437\u0430\u043a\u0443\u043f\u043a\u0435."; var signature_text=getSignIntentionTemplate().apply(resp.procedure);signature_text+="\n"+intention_text;Ext.getCmp("signature_text").setValue(signature_text)}else Ext.Msg.alert("\u041e\u0448\u0438\u0431\u043a\u0430",resp.message)})}}})},intentionslistAction:function(params,app,panel){panel.add({xtype:"Application.components.fullscreenPanel",cmpType:"Application.components.IntentionGrid",title:"\u041d\u0430\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u043e\u0431 \u0443\u0447\u0430\u0441\u0442\u0438\u0438 \u0432 \u0437\u0430\u043a\u0443\u043f\u043a\u0435", cmpParams:{directFn:RPC.Applic.intentionslist,list_type:"my"}})},procsintentionsAction:function(params,app,panel){panel.add({xtype:"Application.components.fullscreenPanel",cmpType:"Application.components.IntentionGrid",title:"\u041d\u0430\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u043e\u0431 \u0443\u0447\u0430\u0441\u0442\u0438\u0438 \u0432 \u0437\u0430\u043a\u0443\u043f\u043a\u0435",cmpParams:{directFn:RPC.Applic.intentionslist,list_type:"procs"}})},viewintentionAction:function(params,app,panel){panel.add({xtype:"Application.components.actionPanel", cmpType:"Application.components.IntentionViewForm",title:"\u041d\u0430\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u043e\u0431 \u0443\u0447\u0430\u0441\u0442\u0438\u0438 \u0432 \u0437\u0430\u043a\u0443\u043f\u043a\u0435",cmpParams:{lot_id:params.lot}})},historyAction:function(params,app,panel){panel.add({xtype:"Application.components.fullscreenPanel",cmpType:"Application.components.ApplicHistoryGridPanel",title:"\u0418\u0441\u0442\u043e\u0440\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439", cmpParams:{directFn:RPC.Applic.history,application_id:params.id}})},commissionlistAction:function(params,app,panel){panel.add({xtype:"Application.components.fullscreenPanel",cmpType:"Application.components.CommissionFormGrid"})}});Ext.ns("Application.controllers.comModule"); Application.controllers.comModule.ContractController=Ext.extend(Application.controllers.Abstract,{title:"\u0414\u043e\u0433\u043e\u0432\u043e\u0440\u044b",indexAction:function(params,app,panel){panel.add({xtype:"Application.components.actionPanel",cmpType:"Application.components.Contract2FormPanel",title:"\u0414\u043e\u0433\u043e\u0432\u043e\u0440\u044b \u043f\u043e \u043b\u043e\u0442\u0443",cmpParams:{lot_id:params.lot,customer_id:params.customer,supplier_id:params.supplier,as_mode:params.as,activeTab:params.tab|| 0}})},edsAction:function(params,app,panel){panel.add({xtype:"Application.components.actionPanel",cmpType:"Application.components.ContractEdsPanel",title:"\u0414\u043e\u0433\u043e\u0432\u043e\u0440\u044b \u043f\u043e \u043b\u043e\u0442\u0443",cmpParams:{lot_id:params.lot,customer_id:params.customer,supplier_id:params.supplier}})},listAction:function(params,app,panel){var panel_title="";params.type=params.type||(isAdmin()?"contract":"mycontract");var newtabs=params.newtabs=="1"||false;var additional= params.additional=="1"||false;var secondFilter="contractarchive";switch(params.type){case "contractarchivecust":panel_title="\u041c\u043e\u0438 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u044b \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0435 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u0430";break;case "contractarchivesuppl":panel_title="\u041c\u043e\u0438 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u044b \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0435 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044f"; break;case "contractarchive":panel_title="\u041c\u043e\u0438 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0435 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u044b";break;case "contract":panel_title="\u041c\u043e\u0438 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u044b \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f";break;case "contractcust":panel_title="\u041c\u043e\u0438 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u044b \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u0430"; if(newtabs){panel_title="\u041c\u043e\u0438 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u044b \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u0430";secondFilter="contractarchivecust"}break;case "contractsuppl":panel_title="\u041c\u043e\u0438 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u044b \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044f"; if(newtabs){panel_title="\u041c\u043e\u0438 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u044b \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044f";secondFilter="contractarchivesuppl"}break;case "mycontract":panel_title="\u041c\u043e\u0438 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u044b";break;case "addcontract":panel_title="\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f"; break}if(additional)panel_title=panel_title.replace("\u041c\u043e\u0438 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u044b","\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f");panel.add({xtype:"Application.components.fullscreenPanel",cmpType:"Application.components.ContractsTabPanel",title:panel_title,cmpParams:{filter:params.type,secondFilter:secondFilter,newtabs:newtabs,additional:additional}})},sendAction:function(params, app,panel){var cmp={};switch(parseInt(params.type)){case TYPE_OOS_CONTRACT:cmp={title:"\u041f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u0432 \u0440\u0435\u0435\u0441\u0442\u0440 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u043e\u0432 \u043d\u0430 zakupki.gov.ru",type:"Application.components.ContractRegistryPublishForm"};break;case TYPE_OOS_SUBCONTRACTOR_INFO:return false;case TYPE_OOS_CONTRACT_EXECUTION:cmp={title:"\u041f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044f \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u0439 \u043e\u0431 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u043d\u0430 zakupki.gov.ru", type:"Application.components.ContractExecutionPublishForm"};break;case TYPE_OOS_CONTRACT_TERMINATION:cmp={title:"\u041f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044f \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u0439 \u043e \u0440\u0430\u0441\u0442\u043e\u0440\u0436\u0435\u043d\u0438\u0438 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u043d\u0430 zakupki.gov.ru",type:"Application.components.ContractTerminationPublishForm"};break}panel.add({xtype:"Application.components.actionPanel",cmpType:cmp.type, title:cmp.title,width:1E3,cmpParams:{contract_id:params.id,message_type:params.type}})},reasonAction:function(params,app,panel){panel.add({xtype:"Application.components.actionPanel",cmpType:"Application.components.ContractSignReasonPanel",title:"\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u043e \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430",cmpParams:{lot_id:params.lot,stage:51}})}});Ext.ns("Application.controllers.comModule"); Application.controllers.comModule.ProcedureController=Ext.extend(Application.controllers.Abstract,{title:"\u041f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b",indexAction:function(params,app,panel){if(1==2&&Main.config.service_redirect&&!Main.contragent.tariff_page_visited&&Main.user.user_type==TYPE_USER)document.location.href="/sync/ordertariff";var procedure_type_title="\u0410\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b";if(params.type)if(params.type== "archive")procedure_type_title="\u0410\u0440\u0445\u0438\u0432 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440";else if(params.type=="auctions")procedure_type_title="\u042d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u044b\u0435 \u0430\u0443\u043a\u0446\u0438\u043e\u043d\u044b";else if(params.type=="auctionsdown")procedure_type_title="\u0420\u0435\u0434\u0443\u043a\u0446\u0438\u043e\u043d\u044b";else if(params.type=="auctionsup")procedure_type_title="\u0410\u0443\u043a\u0446\u0438\u043e\u043d\u044b \u043d\u0430 \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u0435"; else if(params.type=="contest")procedure_type_title="\u041a\u043e\u043d\u043a\u0443\u0440\u0441\u044b";else if(params.type=="pricelist")procedure_type_title="\u0417\u0430\u043f\u0440\u043e\u0441\u044b \u043a\u043e\u0442\u0438\u0440\u043e\u0432\u043e\u043a";else if(params.type=="quotation")procedure_type_title="\u0417\u0430\u043f\u0440\u043e\u0441\u044b \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0439";else if(params.type=="representatives")procedure_type_title="\u041e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0435\u0439"; panel.add({xtype:"Application.components.fullscreenPanel",cmpType:"Application.components.ProcedureGrid",title:procedure_type_title,cmpParams:{filter:params.type,customer_id:params.customer_id||false}})},monitoringAction:function(params,app,panel){panel.add({xtype:"Application.components.fullscreenPanel",cmpType:"Application.components.ProcedureGrid",title:"\u0412\u0441\u0435 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b",cmpParams:{filter:"monitoring"}})},myAction:function(params,app,panel){panel.add({xtype:"Application.components.fullscreenPanel", cmpType:"Application.components.ProcedureGrid",title:"\u041c\u043e\u0438 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b",cmpParams:{filter:"mine"}})},participationAction:function(params,app,panel){panel.add({xtype:"Application.components.fullscreenPanel",cmpType:"Application.components.ProcedureGrid",title:"\u041f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u0441 \u043c\u043e\u0438\u043c \u0443\u0447\u0430\u0441\u0442\u0438\u0435\u043c",cmpParams:{filter:"participation"}})},favouriteAction:function(params, app,panel){panel.add({xtype:"Application.components.fullscreenPanel",cmpType:"Application.components.ProcedureGrid",title:"\u0418\u0437\u0431\u0440\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b",cmpParams:{filter:"favourite"}})},newAction:function(params,app,panel){if(Main.contragent.customer_accreditations=="")panel.add({xtype:"Application.components.actionPanel",title:"\u0414\u043e\u0441\u0442\u0443\u043f \u0437\u0430\u043f\u0440\u0435\u0449\u0435\u043d",cmpType:"Application.components.nowayPanel", cmpParams:{html:'

\u0414\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0439 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430 \u0430\u043a\u043a\u0440\u0435\u0434\u0438\u0442\u0430\u0446\u0438\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0442\u043e\u0440\u0430.

'}}); else panel.add({xtype:"Application.components.actionPanel",cmpType:"Application.components.procedureEditForm",width:950,forceHeader:true,stageParam:false,title:"\u041d\u043e\u0432\u0430\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430"})},editAction:function(params,app,panel){if(Main.procedure_edit_link_redirect){var redirect_link=Main.procedure_edit_link_redirect;Main.procedure_edit_link_redirect=null;redirect_to(redirect_link)}else panel.add({xtype:"Application.components.actionPanel", cmpType:"Application.components.procedureEditForm",width:950,forceHeader:true,title:"\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b",cmpParams:{procedure_id:params.id}})},peretorgAction:function(params,app,panel){panel.add({xtype:"Application.components.actionPanel",cmpType:"Application.components.procedureEditForm",width:950,forceHeader:true,title:"\u041f\u0435\u0440\u0435\u0442\u043e\u0440\u0436\u043a\u0430 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u043f\u043e \u043b\u043e\u0442\u0443", cmpParams:{procedure_id:params.procedure_id,lot_id:params.lot_id,frm:params.frm}})},doretorgAction:function(params,app,panel){panel.add({xtype:"Application.components.actionPanel",cmpType:"Application.components.procedureEditForm",width:950,forceHeader:true,title:"\u0414\u043e\u0442\u043e\u0440\u0436\u043a\u0430 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b",cmpParams:{procedure_id:params.id,stageParam:params.stage}})},restoreAction:function(params,app,panel){panel.add({xtype:"Application.components.actionPanel", cmpType:"Application.components.procedureRestoreForm",width:950,cmpParams:{procedure_id:params.procedure,lot_id:params.lot}})},cancelAction:function(params,app,panel){panel.add({xtype:"Application.components.actionPanel",cmpType:"Application.components.procedureCancelForm",width:950,cmpParams:{procedure_id:params.id,lot_id:params.lot}})},signAction:function(params,app,panel){var additionalFields=[];if(params.id&&undefined==params.procedure)params.procedure=params.id;additionalFields.push({nm:"procedure_id", val:params.procedure});panel.add({xtype:"Application.components.actionPanel",cmpType:"Application.components.SignatureForm",cmpParams:{backUrl:"com/procedure/edit/id/"+params.procedure,additional:additionalFields,useFormHandler:false,api:RPC.Procedure.sign},listeners:{afterrender:function(){var p={};p.procedure_id=params.procedure;performRPCCall(RPC.Procedure.loaddraft,[p],null,function(resp){if(resp&&resp.success){var tpl=getProcedureSignatureTemplate(resp.procedure.procedure_type);var signature_text= tpl.applyTemplate(resp.procedure);Ext.getCmp("signature_text").setValue(signature_text)}else echoResponseMessage(resp)})}}})},viewAction:function(params,app,panel){panel.add({xtype:"Application.components.actionPanel",cmpType:"Application.components.ProcedureFullViewPanel",title:"\u0418\u0437\u0432\u0435\u0449\u0435\u043d\u0438\u0435 \u043e \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0438 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b",cmpParams:{title:"\u0418\u0437\u0432\u0435\u0449\u0435\u043d\u0438\u0435 \u043e \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0438 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b", cls:"procedure-view-short",procedure_id:params.procedure}})},requestAction:function(params,app,panel){var cmpParams,title="\u0417\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043a \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435";if(params.type=="request")cmpParams={request_id:"",disableFilePanel:false, message_name:"request_message",textareaFieldTitle:"\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 / \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430"};else if(params.type=="response"){if(!!params.personal)title="\u0418\u043d\u0434\u0438\u0432\u0438\u0434\u0443\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043a \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435"; else title="\u0420\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043a \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435";cmpParams={request_id:params.reqid,personal:!!params.personal,disableFilePanel:false,message_name:"response_message",textareaFieldTitle:"\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 / \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f"}}else if(params.type== "cancel")cmpParams={request_id:params.reqid,disableFilePanel:true,message_name:"cancel_reason",textareaFieldTitle:"\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 / \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u0438\u0447\u0438\u043d\u044b \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430"};Ext.apply(cmpParams,{title:title,lot_id:params.lot,procedure_id:params.procedure,request_type:params.type,submit_fn:RPC.Procedure.saveRequest, rpc_load_request:RPC.Procedure.loadRequest,rpc_load_request_type:"doc",rpc_remove_request_file:RPC.Procedure.removeRequestFile,sign_action:"signrequest"});panel.add({xtype:"Application.components.actionPanel",cmpType:"Application.components.RequestForm",cmpParams:cmpParams})},signrequestAction:function(params,app,panel){var additionalFields=[];var backurl="";var rpcAction=RPC.Procedure.signRequest;if(params["type"]=="request"){additionalFields.push({nm:"lot_id",val:params.lot});backurl="com/procedure/request/type/request/procedure/"+ params.procedure+"/lot/"+params.lot}else if(params["type"]=="response"){additionalFields.push({nm:"request_id",val:params.reqid});backurl="com/procedure/request/type/response/reqid/"+params.reqid+"/procedure/"+params.procedure;rpcAction=RPC.Procedure.signRequestResponse}else if(params["type"]=="cancel"){additionalFields.push({nm:"request_id",val:params.reqid});backurl="com/procedure/request/type/cancel/reqid/"+params.reqid+"/procedure/"+params.procedure;rpcAction=RPC.Procedure.signRequestCancel}additionalFields.push({nm:"type", val:params.type});panel.add({xtype:"Application.components.actionPanel",cmpType:"Application.components.SignatureForm",cmpParams:{backUrl:backurl,additional:additionalFields,api:rpcAction},listeners:{afterrender:function(){RPC.Procedure.requestSignatureText(params,function(provider,resp){if(resp.result.success)Ext.getCmp("signature_text").setValue(resp.result.message);else Ext.MessageBox.alert("\u041e\u0448\u0438\u0431\u043a\u0430",resp.result.message)})}}})},requestsAction:function(params,app,panel){var cmpParams= {type:"all"};panel.add({xtype:"Application.components.fullscreenPanel",cmpType:"Application.components.RequestDashboard",cmpParams:{requestGridParams:cmpParams,filter_query:params.procedure},title:"\u0420\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043a \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430\u043c"})},requestlistAction:function(params,app,panel){var cmpParams={type:"request"};panel.add({xtype:"Application.components.fullscreenPanel", cmpType:"Application.components.RequestDashboard",cmpParams:{requestGridParams:cmpParams,filter_query:params.procedure},title:"\u0420\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043a \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430\u043c"})},showrequestAction:function(params,app,panel){panel.add({xtype:"Application.components.actionPanel",cmpType:"Application.components.RequestView",title:"\u0417\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043a \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435", cmpParams:{title:"\u0417\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043a \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435",procedure:params.procedure,lot:params.lot,request:params.reqid,readOnly:true,submit_fn:RPC.Procedure.saveRequest,rpc_load_request:RPC.Procedure.loadRequest,rpc_load_request_type:"doc"}})},showexplainAction:function(params,app,panel){panel.add({xtype:"Application.components.actionPanel", cmpType:"Application.components.ExplainView",title:"\u0420\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043a \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435",cmpParams:{title:"\u0420\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043a \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435",procedure:params.procedure, lot:params.lot,request:params.reqid}})},pauseAction:function(params,app,panel){panel.add({xtype:"Application.components.actionPanel",cmpType:"Application.components.ProcedurePauseForm",title:"\u041f\u0440\u0438\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b",cmpParams:{directFn:RPC.Procedure.pause,procedure_id:params.procedure,lot_id:params.lot,action:"pause"}})},resumeAction:function(params,app,panel){panel.add({xtype:"Application.components.actionPanel", cmpType:"Application.components.ProcedurePauseForm",title:"\u0412\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b",cmpParams:{directFn:RPC.Procedure.resume,procedure_id:params.procedure,lot_id:params.lot,action:"resume"}})},tradeAction:function(params,app,panel){panel.add({xtype:"Application.components.actionPanel",cmpType:"Application.components.Trade",title:"\u0410\u0443\u043a\u0446\u0438\u043e\u043d",cmpParams:{procedure_id:params.procedure, lot_id:params.lot,cls:Ext.isGecko?"x-maskable":""}})},historyAction:function(params,app,panel){panel.add({xtype:"Application.components.fullscreenPanel",cmpType:"Application.components.HistoryPanel",title:"\u0418\u0441\u0442\u043e\u0440\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439",cmpParams:{procedure_id:params.procedure,type:"procedure"}})},requestresultAction:function(params,app,panel){var title="";if(params.type=="request")var cmpParams={message_type:params.message_type, request_id:"",disableFilePanel:false,message_name:"request_message",textareaFieldTitle:this.getMessageTypeTitle(params.message_type,"messagebox")};else if(params.type=="response")var cmpParams={request_id:params.reqid,disableFilePanel:false,original_message_type:params.message_type,personal:params.personal,message_name:"response_message",textareaFieldTitle:"\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 / \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f"}; else if(params.type=="cancel")var cmpParams={request_id:params.reqid,disableFilePanel:true,message_name:"cancel_reason",textareaFieldTitle:"\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 / \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u0438\u0447\u0438\u043d\u044b \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430"};var title=this.getMessageTypeTitle(params.message_type,params.type,!!params.personal);Ext.apply(cmpParams, {title:title,lot_id:params.lot,procedure_id:params.procedure,request_type:params.type,submit_fn:RPC.Procedure.saveRequestResult,rpc_load_request:RPC.Procedure.loadRequest,rpc_load_request_type:"result",rpc_remove_request_file:RPC.Procedure.removeRequestResultFile,sign_action:"signrequestresult"});panel.add({xtype:"Application.components.actionPanel",cmpType:"Application.components.RequestForm",cmpParams:cmpParams})},signrequestresultAction:function(params,app,panel){var additionalFields=[];var backurl= "";if(params["type"]=="request"){additionalFields.push({nm:"lot_id",val:params.lot});additionalFields.push({nm:"message_type",val:params.message_type});backurl="com/procedure/requestresult/type/request/procedure/"+params.procedure+"/lot/"+params.lot+"/message_type/"+params.message_type}else if(params["type"]=="response"){additionalFields.push({nm:"request_id",val:params.reqid});backurl="com/procedure/requestresult/type/response/procedure/"+params.procedure+"/reqid/"+params.reqid}else if(params["type"]== "cancel"){additionalFields.push({nm:"request_id",val:params.reqid});backurl="com/procedure/requestresult/type/cancel/procedure/"+params.procedure+"/reqid/"+params.reqid}additionalFields.push({nm:"type",val:params.type});panel.add({xtype:"Application.components.actionPanel",cmpType:"Application.components.SignatureForm",cmpParams:{backUrl:backurl,additional:additionalFields,api:RPC.Procedure.signRequestResult},listeners:{afterrender:function(){RPC.Procedure.requestResultSignatureText(params,function(provider, resp){if(resp.result.success)Ext.getCmp("signature_text").setValue(resp.result.message);else Ext.MessageBox.alert("\u041e\u0448\u0438\u0431\u043a\u0430",resp.result.message)})}}})},requestresultlistAction:function(params,app,panel){var cmpParams={type:"requestresult",message_type:params.message_type||false};panel.add({xtype:"Application.components.fullscreenPanel",cmpType:"Application.components.RequestDashboard",cmpParams:{requestGridParams:cmpParams,filter_query:params.procedure},title:params.message_type? this.getMessageTypeTitle(params.message_type,"title"):"\u0417\u0430\u043f\u0440\u043e\u0441\u044b \u0438 \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f"})},showrequestresultAction:function(params,app,panel){var title=this.getMessageTypeTitle(params.message_type,"request");panel.add({xtype:"Application.components.actionPanel",cmpType:"Application.components.RequestView",title:title,cmpParams:{title:title,procedure:params.procedure,lot:params.lot,request:params.reqid,message_type:params.message_type, readOnly:true,submit_fn:RPC.Procedure.saveRequestResult,rpc_load_request:RPC.Procedure.loadRequest,rpc_load_request_type:"result"}})},requestapplicAction:function(params,app,panel){var cmpParams;var titles={request:"\u0417\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0440\u0430\u0437\u044c\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0437\u0430\u044f\u0432\u043a\u0438",response:(!!params.personal?"\u0418\u043d\u0434\u0438\u0432\u0438\u0434\u0443\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435": "\u0420\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435")+" \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043d\u0430 \u0440\u0430\u0437\u044c\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0437\u0430\u044f\u0432\u043a\u0438"};if(params.type=="request")cmpParams={request_id:"",disableFilePanel:false,message_name:"request_message",textareaFieldTitle:"\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 / \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430"}; else if(params.type=="response")cmpParams={request_id:params.reqid,disableFilePanel:false,message_name:"response_message",textareaFieldTitle:"\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 / \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f"};else if(params.type=="cancel")cmpParams={request_id:params.reqid,disableFilePanel:true,message_name:"cancel_reason",textareaFieldTitle:"\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 / \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u0438\u0447\u0438\u043d\u044b \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430"}; Ext.apply(cmpParams,{title:titles[params.type],lot_id:params.lot,procedure_id:params.procedure,personal:!!params.personal,application_id:params.application,request_type:params.type,submit_fn:RPC.Procedure.saveRequestApplication,rpc_load_request:RPC.Procedure.loadRequest,rpc_load_request_type:"application",rpc_remove_request_file:RPC.Procedure.removeRequestApplicationFile,sign_action:"signrequestapplic"});panel.add({xtype:"Application.components.actionPanel",cmpType:"Application.components.RequestForm", cmpParams:cmpParams})},requestappliclistAction:function(params,app,panel){var cmpParams={type:"requestapplic",message_type:params.message_type||false};panel.add({xtype:"Application.components.fullscreenPanel",cmpType:"Application.components.RequestDashboard",cmpParams:{requestGridParams:cmpParams,activeTab:params.activetab,filter_query:params.procedure,hideNavigation:true,supplier:params.supplier},title:"\u0420\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0437\u0430\u044f\u0432\u043e\u043a \u043d\u0430 \u0443\u0447\u0430\u0441\u0442\u0438\u0435"})}, signrequestapplicAction:function(params,app,panel){var additionalFields=[];var backurl="";if(params["type"]=="request"){additionalFields.push({nm:"lot_id",val:params.lot});additionalFields.push({nm:"application_id",val:params.application});backurl="com/procedure/requestapplic/type/request/application/"+params.application+"/lot/"+params.lot+"/procedure/"+params.procedure}else if(params["type"]=="response"){additionalFields.push({nm:"request_id",val:params.reqid});backurl="com/procedure/requestapplic/type/response/id/"+ params.id+"/reqid/"+params.reqid}else if(params["type"]=="cancel"){additionalFields.push({nm:"request_id",val:params.reqid});backurl="com/procedure/requestapplic/type/cancel/id/"+params.id+"/reqid/"+params.reqid}additionalFields.push({nm:"type",val:params.type});panel.add({xtype:"Application.components.actionPanel",cmpType:"Application.components.SignatureForm",cmpParams:{backUrl:backurl,additional:additionalFields,api:RPC.Procedure.signRequestApplic},listeners:{afterrender:function(){RPC.Procedure.requestApplicSignatureText(params, function(provider,resp){if(resp.result.success)Ext.getCmp("signature_text").setValue(resp.result.message);else Ext.MessageBox.alert("\u041e\u0448\u0438\u0431\u043a\u0430",resp.result.message)})}}})},showrequestapplicAction:function(params,app,panel){panel.add({xtype:"Application.components.actionPanel",cmpType:"Application.components.RequestView",title:"\u0417\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0437\u0430\u044f\u0432\u043a\u0438 \u043d\u0430 \u0443\u0447\u0430\u0441\u0442\u0438\u0435", cmpParams:{title:"\u0417\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0437\u0430\u044f\u0432\u043a\u0438 \u043d\u0430 \u0443\u0447\u0430\u0441\u0442\u0438\u0435",procedure:params.procedure,lot:params.lot,request:params.reqid,readOnly:true,submit_fn:RPC.Procedure.saveRequestApplication,rpc_load_request:RPC.Procedure.loadRequest,rpc_load_request_type:"application"}})},invitesAction:function(params, app,panel){panel.add({xtype:"Application.components.fullscreenPanel",cmpType:"Application.components.InvitesLogGrid",title:"\u0420\u0430\u0441\u0441\u044b\u043b\u043a\u0438 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0439"})},sendinvitesAction:function(params,app,panel){panel.add({xtype:"Application.components.actionPanel",cmpType:"Application.components.ProcedureInvitesForm",title:"\u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0439", cmpParams:{procedure_id:params.procedure?params.procedure:null}})},changedatesAction:function(params,app,panel){panel.add({xtype:"Application.components.actionPanel",cmpType:"Application.components.ProcedureChangeDatesForm",title:"\u041f\u0435\u0440\u0435\u0432\u043e\u0434 \u0441\u0440\u043e\u043a\u043e\u0432 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f",cmpParams:{lot_id:params.lot?params.lot:null}})},decisionAction:function(params,app,panel){panel.add({xtype:"Application.components.actionPanel", cmpType:"Application.components.ProcedureDecisionForm",title:"\u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u0438\u0442\u043e\u0433\u043e\u0432 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b"})},documentAddAction:function(params,app,panel){panel.add({xtype:"Application.components.actionPanel",cmpType:"Application.components.ProcedureDocumentAddForm",title:"\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 \u0432 \u0441\u043e\u0441\u0442\u0430\u0432 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u0432", cmpParams:{lot_id:params.lot,procedure_id:params.procedure}})},operatorDocumentAddAction:function(params,app,panel){panel.add({xtype:"Application.components.actionPanel",cmpType:"Application.components.procedureOperatorDocumentAddForm",title:"\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 \u0432 \u0438\u0437\u0432\u0435\u0449\u0435\u043d\u0438\u0435",cmpParams:{lot_id:params.lot,procedure_id:params.procedure}})},statisticsAction:function(params, app,panel){panel.add({xtype:"Application.components.actionPanel",cmpType:"Application.components.ProcedureStatisticsPanel",cmpParams:{title:"\u041e\u0442\u0447\u0435\u0442\u044b"}})},expertsAction:function(params,app,panel){panel.add({xtype:"Application.components.actionPanel",cmpType:"Application.components.procedureExpertsForm",width:950,cmpParams:{procedure_id:params.id}})},inviteemailsAction:function(params,app,panel){panel.add({xtype:"Application.components.actionPanel",cmpType:"Application.components.procedureInviteEmailsForm", cmpParams:{procedure_id:params.id}})},accesslogAction:function(params,app,panel){panel.add({title:"\u0414\u043e\u0441\u0442\u0443\u043f \u043a \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430\u043c",xtype:"Application.components.fullscreenPanel",cmpType:"Application.components.procedureAccessLogGrid"})},prolongateAction:function(params,app,panel){panel.add({xtype:"Application.components.actionPanel",cmpType:"Application.components.ProcedureProlongateForm",title:"\u041f\u0435\u0440\u0435\u0432\u043e\u0434 \u0441\u0440\u043e\u043a\u043e\u0432", cmpParams:{lot_id:params.lot?params.lot:null,procedure_id:params.procedure?params.procedure:null,prolongate:true}})},reportsAction:function(params,app,panel){panel.add({xtype:"Application.components.fullscreenPanel",cmpType:"Application.components.AdminReportsBrowser",title:"\u041e\u0442\u0447\u0451\u0442\u044b"})},contractdocumentsAction:function(params,app,panel){panel.add({xtype:"Application.components.actionPanel",cmpType:"Application.components.ContractDocumentsPanel",title:"\u041f\u0430\u043a\u0435\u0442 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430", cmpParams:{lot_id:params["lot"],supplier_id:params["supplier_id"]}})},getMessageTypeTitle:function(type_id,placer,is_personal){var messages=[];placer=placer||"title";is_personal=is_personal||false;type_id=parseInt(type_id);messages[0]={title:"\u0412\u0441\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043d\u0430 \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435"};messages[1]={messagebox:"\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 / \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043d\u0430 \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u0438\u0442\u043e\u0433\u043e\u0432 \u0442\u043e\u0440\u0433\u043e\u0432", request:"\u0417\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u0438\u0442\u043e\u0433\u043e\u0432 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440",title:"\u0417\u0430\u043f\u0440\u043e\u0441\u044b \u043d\u0430 \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u0438\u0442\u043e\u0433\u043e\u0432 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440",response:"\u0420\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u0438\u0442\u043e\u0433\u043e\u0432 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440"}; messages[2]={messagebox:"\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 / \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043d\u0430 \u0440\u0430\u0437\u044c\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u0438\u0442\u043e\u0433\u043e\u0432 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u0442\u0431\u043e\u0440\u0430",request:"\u0417\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0440\u0430\u0437\u044c\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u0438\u0442\u043e\u0433\u043e\u0432 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u0442\u0431\u043e\u0440\u0430", title:"\u0417\u0430\u043f\u0440\u043e\u0441\u044b \u043d\u0430 \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u0438\u0442\u043e\u0433\u043e\u0432 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u0442\u0431\u043e\u0440\u0430",response:"\u0420\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u0438\u0442\u043e\u0433\u043e\u0432 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u0442\u0431\u043e\u0440\u0430"}; messages[3]={messagebox:"\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 / \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043d\u0430 \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u043a\u0443\u0440\u0441\u043d\u044b\u0445 \u0437\u0430\u044f\u0432\u043e\u043a",request:"\u0417\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u043a\u0443\u0440\u0441\u043d\u044b\u0445 \u0437\u0430\u044f\u0432\u043e\u043a", title:"\u0417\u0430\u043f\u0440\u043e\u0441\u044b \u043d\u0430 \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u043a\u0443\u0440\u0441\u043d\u044b\u0445 \u0437\u0430\u044f\u0432\u043e\u043a",response:"\u0420\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u043a\u0443\u0440\u0441\u043d\u044b\u0445 \u0437\u0430\u044f\u0432\u043e\u043a"}; if(!type_id||!messages[type_id])return false;var result=type_id>0?messages[type_id][placer]:messages[0][placer];if(placer=="response"&&is_personal)result=result.replace("\u0420\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435","\u0418\u043d\u0434\u0438\u0432\u0438\u0434\u0443\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435");return result}});Ext.ns("Application.controllers.comModule"); Application.controllers.comModule.ProtocolController=Ext.extend(Application.controllers.Abstract,{title:"\u041f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u044b",signprotocolAction:function(params,app,panel){var additionalFields=[];additionalFields.push({nm:"lot_id",val:params.lot});additionalFields.push({nm:"stage",val:params.stage});var back_url="com/applic/review/lot/"+params.lot+"/stage/"+params.stage;if(params.stage==5)back_url="com/applic/openapplics/lot/"+params.lot+"/stage/"+params.stage;if(params.act&& params.act=="decline")back_url+="/act/"+params.act;var panel_id=Ext.id();panel.add({xtype:"Application.components.actionPanel",cmpType:"Application.components.SignatureForm",cmpParams:{backUrl:back_url,additional:additionalFields,useFormHandler:false,id:panel_id,api:RPC.Protocol.signprotocol,success_fn:function(resp){if(resp.status_blocked&&resp.status_blocked===true)window.location="/";else redirect_to("com/procedure/index")},buttons:[{text:"\u0417\u0430\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u0432\u0441\u0435 \u0432\u0442\u043e\u0440\u044b\u0435 \u0447\u0430\u0441\u0442\u0438", hidden:true,handler:function(){redirect_to("com/applic/showAllApplic/lot/"+params.lot)}}]},listeners:{afterrender:function(){Ext.getCmp(panel_id).el.mask("\u0418\u0434\u0435\u0442 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0442\u0435\u043a\u0441\u0442\u0430 \u0434\u043b\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u044f. \u041f\u043e\u0434\u043e\u0436\u0434\u0438\u0442\u0435...","x-mask-loading");RPC.Protocol.getSignProtocolText(params.lot,params.stage,function(provider,resp){if(Ext.getCmp(panel_id)){Ext.getCmp(panel_id).el.unmask(); if(resp.result.success){var signature_text=resp.result.text_protocol;Ext.getCmp("signature_text").setValue(signature_text)}else echoResponseMessage(resp.result)}})}}})},indexAction:function(params,app,panel){panel.add({xtype:"Application.components.actionPanel",cmpType:"Application.components.ProtocolListPanel",title:"\u041f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u044b \u043f\u043e \u043b\u043e\u0442\u0443",cmpParams:{lot_id:params.lot}})},oosqueueAction:function(params,app,panel){panel.add({xtype:"Application.components.actionPanel", cmpType:"Application.components.ProtocolExchangeGrid",title:"\u0412\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u0415\u0418\u0421 \u043f\u043e \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u0432 \u043f\u043e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435",cmpParams:{procedure_id:params.procedure}})}});Application.components.ApplicEditTab=Ext.extend(Ext.form.FormPanel,{frame:true,border:false,getValues:function(){var v={};collectComponentValues(this,v,true);return v},setValues:function(v){setComponentValues(this,v,true)},getDocumentFieldset:function(docPanelId,docPanelName,disabled){var component=this;var noneditable=component.noneditable||false;var panelName=docPanelId=="max_sum_docs_fset"?docPanelName+REQUIRED_FIELD:docPanelName;var fset={xtype:"fieldset",title:panelName,disabled:disabled||false, id:docPanelId,items:[]};if(!noneditable)fset.items.push({html:"\u0414\u043b\u044f \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0439\u0442\u0435 \u0438\u0445 \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u043e\u0440\u043c\u044b \u043d\u0438\u0436\u0435. "+ACCEPTED_FILES+".",cls:"spaced-bottom-shallow"});return fset},constructDocumentUploadPanel:function(docKeyName, doctype,partNumber,partDocReq){var component=this;var reasn=partDocReq?partDocReq.reason!=""?" (\u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0435: "+partDocReq.reason+")":"":null;var docTitle=partDocReq?partDocReq.requirement+reasn:null;var drawFrame=true;if(docTitle==null)drawFrame=false;var docPanelId=partDocReq?"doc_req_"+partDocReq.id:docKeyName+"_"+partNumber;var cmptype=component.noneditable?"Application.components.FilelistFieldset":"Application.components.multiuploadPanel";var cmpborder= component.noneditable?false:true;var panelName=docKeyName;if(partDocReq!==undefined)panelName=panelName+("-"+partDocReq.id);var docUploadPanel={xtype:cmptype,name:panelName,requiredDescr:partDocReq?true:false,isDocReq:partDocReq?true:false,uploadHandler:RPC.Applic.addFile,deleteHandler:RPC.Applic.removeFile,hideTitle:true,autoUpload:true,title:docTitle,fdata:partDocReq,style:component.noneditable?"margin: 0; padding: 10px 10px 5px 10px":"margin: 0; padding: 0",frame:drawFrame,border:true,id:docPanelId, listeners:{},withHash:false};docUploadPanel.filePanelChanged=function(){if(this.isDocReq==false||component.noneditable)return;var descr_panel_id=this.items.items[1].descrPanelId;var files=this.getFilesInfo();if(descr_panel_id!=undefined){if(files.length>0){Ext.getCmp(descr_panel_id).allowBlank=true;return}Ext.getCmp(descr_panel_id).allowBlank=false}};docUploadPanel.setValues=function(v){if(!v)return;this.removeAllInfo();for(var i=0;i0)docUploadPanel.setValues(docs)},getPartNumberHiddenField:function(partNumber){return{xtype:"textfield",hidden:true,name:"partNumber",value:partNumber}},setDocReqs:function(partNumber){var docreqs=this.parent.lot_data.lot_doc_requirements;var partDocReqs=[];for(var i=0;i=0)return false;if(Ext.getCmp(component.parent.shared_ids.sm_business_declaration_id))return false;var panel={xtype:"fieldset",title:"\u0414\u0435\u043a\u043b\u0430\u0440\u0430\u0446\u0438\u044f \u043e \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u043d\u043e\u0441\u0442\u0438 \u043a \u0441\u0443\u0431\u044a\u0435\u043a\u0442\u0430\u043c \u041c\u0421\u041f", id:component.parent.shared_ids.sm_business_declaration_id,style:"margin: 5px",anchor:"100%",layout:"anchor",hidden:true,items:[{html:"\u041d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u043c \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u043c, \u0447\u0442\u043e \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0438\u043c \u043a \u0441\u0443\u0431\u044a\u0435\u043a\u0442\u0430\u043c \u043c\u0430\u043b\u043e\u0433\u043e \u0438 \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u043f\u0440\u0435\u0434\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430"}, this.constructDocumentUploadPanel("application_docs_smp_declaration",APPLIC_DOC_SMP_DECLARAION,part_number,undefined)],listeners:{afterrender:function(){if(Ext.getCmp(component.parent.shared_ids.sm_business_checkbox_id)&&Ext.getCmp(component.parent.shared_ids.sm_business_checkbox_id).getValue()==true||component.mode=="view")this.setDisabled(false);else this.setDisabled(false)}}};return panel},createSmBusinessCheckBox:function(cmp,default_value,readOnly){if(Ext.getCmp(cmp.parent.shared_ids.sm_business_checkbox_id))return false; default_value=default_value||false;var element={xtype:"panel",style:"margin: 0px 5px",anchor:"100%",layout:"anchor",items:[{xtype:"checkbox",name:"sm_business",id:cmp.parent.shared_ids.sm_business_checkbox_id,boxLabel:"\u0421\u0443\u0431\u044a\u0435\u043a\u0442 \u043c\u0430\u043b\u043e\u0433\u043e \u0438 \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u043f\u0440\u0435\u0434\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430",checked:default_value,disabled:cmp.mode== "view"||!!readOnly?true:false,listeners:{check:function(cp,checked){var declarationPanel=Ext.getCmp(cmp.parent.shared_ids.sm_business_declaration_id);if(declarationPanel){declarationPanel.setDisabled(false);if(!cmp.parent.lot_data.small_biz_only){declarationPanel.setVisible(checked);declarationPanel.doLayout()}}},afterrender:function(cp){if(cp.readOnly)cp.setValue(!!Main.contragent.small_biz);cp.fireEvent("check",cp,!!Main.contragent.small_biz||cmp.parent.applic&&cmp.parent.applic.sm_business)}}}]}; return element}});Application.components.ApplicFirstPartEditTab=Ext.extend(Application.components.ApplicEditTab,{frame:true,border:false,initComponent:function(){var component=this;if(component.parent.noneditable)component.mode="view";else component.mode=component.parent.mode;component.ids=initIds(["app_units_display","app_units_position_display","app_units_position_grid","price","small_business_first_parts_panel","application_suppliers_panel","suppliers_panel","suppliers_enable_checkbox","add_price_registration_cmp", "warning_cmp","digitalPoa_cmp"]);component.ids.docOtherPanelId="application_docs_other_1";component.docExplainPanelId="application_explain_documents_1";component.docPanelName="\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b, \u0437\u0430\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0442\u043e\u0440\u043e\u043c \u0432 \u0441\u043e\u0441\u0442\u0430\u0432\u0435 "+(component.partNumber===1?"\u043f\u0435\u0440\u0432\u043e\u0439": "\u0432\u0442\u043e\u0440\u043e\u0439")+" \u0447\u0430\u0441\u0442\u0438 \u0437\u0430\u044f\u0432\u043a\u0438 \u043d\u0430 \u0443\u0447\u0430\u0441\u0442\u0438\u0435";component.docPanelId="req_docs_part_1";component.parent.max_sum_doc_needed=true;addEvents(component,["lotloaded","applicloaded","afterLotLoaded"]);Ext.apply(component,{title:component.title?component.title:component.parent&&component.parent.totalParts==1?"\u0417\u0430\u044f\u0432\u043a\u0430 \u043d\u0430 \u0443\u0447\u0430\u0441\u0442\u0438\u0435": "\u041f\u0435\u0440\u0432\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0437\u0430\u044f\u0432\u043a\u0438",xtype:"form",name:"parts[]",layout:"form",labelWidth:400,defaults:{allowBlank:false,minLengthText:"\u0421\u043b\u0438\u0448\u043a\u043e\u043c \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435",maxLengthText:"\u0421\u043b\u0438\u0448\u043a\u043e\u043c \u0434\u043b\u0438\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435",anchor:"100%", style:"margin: 5px"},monitorValid:true,autoHeight:true,items:[],listeners:{lotloaded:function(lotData){var cmpItems=component.buildForm();Ext.each(cmpItems,function(item){component.add(item)});var params={};params.procedure_id=lotData["id"];params.contragent_type=Main.contragent.supplier_profile_id!=SUPPLIER_TYPE_FIZ_RF&&Main.contragent.supplier_profile_id!=SUPPLIER_TYPE_FIZ_FOREIGN?"fizik":"urik";if(component.parent.procedure_type==PROCEDURE_TYPE_AUC_ASC_26)params.pp26=true;if(Main.config.agreement_not_for_auctions|| !Main.config.agreement_not_for_auctions&&!(component.parent.procedure_type==PROCEDURE_TYPE_TENDER||component.parent.procedure_type==PROCEDURE_TYPE_PRICELIST_REQ||component.parent.procedure_type==PROCEDURE_TYPE_QUOTATION_REQ))performRPCCall(RPC.Reference.getApplicationText,[params],null,function(resp){if(!component.appl_data||!component.appl_data.agreement_signed_text){var applicationText=resp.application_text;Ext.getCmp("application_text").setValue(applicationText)}});else Ext.getCmp("fieldset_application_text").setVisible(false); if(lotData.customer_agree_form)Ext.getCmp("fieldset_application_text").setVisible(false);component.partDocReqs=component.setDocReqs(component.partNumber);if(component.parent.procedure_type==PROCEDURE_TYPE_AUC_ASC_26){Ext.getCmp("fieldset_application_text").setTitle("\u0421\u043e\u0433\u043b\u0430\u0441\u0438\u0435 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430 \u0430\u0443\u043a\u0446\u0438\u043e\u043d\u0430 \u0441 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u043c\u0438 \u0430\u0443\u043a\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 / \u0421\u043e\u0433\u043b\u0430\u0441\u0438\u0435 \u043d\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445"); var parent_fildst=Ext.getCmp(this.ids.docOtherPanelId).findParentByType("fieldset");if(parent_fildst.title=="\u0418\u043d\u044b\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b")parent_fildst.setTitle("\u0418\u043d\u044b\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 26 \u2013 \u041f\u041f");if(component.mode=="view"&& lotData.lot.status==Application.models.Procedure.statuses.first_parts)parent_fildst.hide()}var docPanel=Ext.getCmp(component.docPanelId);var paramPanel=Ext.getCmp(component.ids.app_units_display);var small_business_panel=Ext.getCmp(component.ids.small_business_first_parts_panel);var units=component.parent.lot_data.lot_units;var isEditableApplication=component.mode!="view"&&!component.noneditable;if(paramPanel)if(units.length>0){for(var i=0;i\u0441\u0441\u044b\u043b\u043a\u0435.',cls:"spaced-bottom-shallow"});small_business_panel.add(component.createSmBusinessCheckBox(component,Main.contragent.small_biz,component.mode=="view"||!!component.noneditable));if(component.parent.procedure_type!=PROCEDURE_TYPE_AUC_ASC_26)small_business_panel.add(component.createBusinessDeclarationUploadPanel(component.partNumber));var declaration_panel=Ext.getCmp(component.parent.shared_ids.sm_business_declaration_id); if(declaration_panel&&component.parent.lot_data.small_biz_only)declaration_panel.setVisible(true)}if(component.parent.totalParts==1&&component.parent.procedure_type!=PROCEDURE_TYPE_AUC_ASC_26){var cmpDataPanel=this.createCmpDataPanel();this.insert(0,cmpDataPanel)}if(component.partDocReqs&&component.partDocReqs.length>0){for(var k=0;k=0)component.add({xtype:"fieldset",id:"date_fields",style:"margin: 5px;",layout:"column",defaults:{anchor:"100%"},items:[{html:"\u0414\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u0434\u0430\u0447\u0438 \u0437\u0430\u044f\u0432\u043a\u0438"+ REQUIRED_FIELD+":",columnWidth:.3},{xtype:"Application.components.dateField",altFormats:"c|d.m.Y H:i:s|d.m.Y H:i",allowBlank:false,name:"date_published",id:"date_published",width:90,value:now(),format:"d.m.Y",columnWidth:.14,getValues:function(){var result=this.getValue(),time=Ext.getCmp("time_published").getValue().split(":");result.setHours(time[0],time[1],0,0);return result}},{html:" ",columnWidth:.02},{xtype:"timefield",allowBlank:false,name:"time_published",id:"time_published",value:now(), width:60,format:"H:i"}]});var priceAllowBlank="";var noneditablePrice=component.parent.noneditable;if(Application.models.Procedure.groups.price_requested.indexOf(component.parent.procedure_type)>=0||component.parent.procedure_type===PROCEDURE_TYPE_QUALIFICATION&&lotData.lot["start_price"]>0){if(!noneditablePrice)priceAllowBlank=REQUIRED_FIELD;if(!in_array(component.parent.procedure_type,[PROCEDURE_TYPE_AUC_ASC,PROCEDURE_TYPE_AUC_DESC])&&!in_array(component.parent.lot_data.lot_step,[LOT_STEP_QUAL_REGISTRATION, LOT_STEP_PREQUALIFICATION,LOT_STEP_PRE_APPLIC_OPENED,LOT_STEP_PRE_QUAL_REGISTRATION])&&component.parent.procedure_data["application_stages"]!=2){if(in_array(component.parent.procedure_type,[PROCEDURE_TYPE_PRICELIST_REQ])){var docPriceOtherPanel=this.getDocumentFieldset(this.docPriceOtherPanelId,"\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b",!isEmpty(component.parent.procedure_data["frm"]));docPriceOtherPanel.items.push(this.constructDocumentUploadPanel("application_docs_price_other",APPLIC_DOC_PRICE_OTHER, 1,undefined))}component.add({xtype:"Application.components.ApplicPriceForm",priceAllowBlank:lotData.procedure_type!=PROCEDURE_TYPE_PRICELIST?priceAllowBlank:"",vat_percent:lotData.lot.vat_percent||0,noneditablePrice:noneditablePrice||false,noneditable:component.noneditable,lot_id:lotData.lot.id,application_id:component.parent.application_id,additional_items:[docPriceOtherPanel||{}]});component.add({id:component.ids.add_price_registration_cmp,title:"\u041f\u043e\u0434\u0430\u0447\u0430 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0439", xtype:"Application.components.ApplicPriceForm",priceAllowBlank:priceAllowBlank,noneditablePrice:noneditablePrice||false,vat_percent:lotData.lot.vat_percent||0,noneditable:component.noneditable,lot_id:lotData.lot.id,application_id:component.parent.application_id,fixVatCheckbox:true,hidden:true,disabled:true,config:{price_cmp_name:"add_price",price_without_vat_cmp_name:"add_price_without_vat"}})}}if(component.parent.totalParts==1)component.add({xtype:"Application.components.DigitalPoaSelectFieldset", id:component.ids["digitalPoa_cmp"],editable:!component.noneditable,hidden:component.mode!="view"&&Main.user.eds_type!==EDS_TYPE_PERSONAL,name:"user_digitalpoa_id"});if(component.mode!="view"&&!component.noneditable&&component.parent.totalParts==1&&component.parent.procedure_type!=PROCEDURE_TYPE_PRICELIST)component.add({xtype:"Application.components.ApplicationSuppliersFieldset",name:"application_suppliers",id:component.ids["suppliers_panel"]});component.doLayout();component.fireEvent("afterLotLoaded")}, applicloaded:function(applic_data){if(applic_data.order_number_added)this.setTitle("\u0417\u0430\u044f\u0432\u043a\u0430 \u043d\u0430 \u0443\u0447\u0430\u0441\u0442\u0438\u0435 \u2116"+applic_data.order_number_added);var lotData=component.parent.lot_data;var totalParts=component.parent.totalParts;component.appl_data=Ext.apply(component.parent.applic,component.parent.applic.parts[0]);if(component.appl_data.agreement_signed_text&&Ext.getCmp("application_text"))Ext.getCmp("application_text").setValue(component.appl_data.agreement_signed_text); if((component.appl_data.full_name&&component.appl_data.full_name!=Main.contragent.full_name||component.appl_data.inn&&component.appl_data.inn!=Main.contragent.inn)&&!component.parent.noneditable&&!(isCustomer()&&Main.config.allow_customer_add_applic)&&!applic_data["is_additional_supplier"])Ext.Msg.alert("\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435","\u0414\u0430\u043d\u043d\u044b\u0435 \u0432\u0430\u0448\u0435\u0439 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u043e\u0442 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0445 \u0432 \u0437\u0430\u044f\u0432\u043a\u0435. \u0414\u043b\u044f \u0438\u0445 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0442\u043e\u0437\u0432\u0430\u0442\u044c \u0437\u0430\u044f\u0432\u043a\u0443 \u0438 \u043f\u043e\u0434\u0430\u0442\u044c \u0435\u0435 \u0441\u043d\u043e\u0432\u0430."); delete component.appl_data["vat_percent"];component.setValues(component.appl_data);if(component.items.get(0)&&component.items.get(0)["items"]&&component.items.get(0).items.get(0)&&component.items.get(0).items.get(0).xtype=="Application.components.keyValue2Panel")component.items.get(0).setValues(applic_data["supplier"]);if(component.appl_data.application_units)for(var i=0;ikeyB)return-1;return 0});var paramCnt=Ext.getCmp("application_unit_params_"+component.appl_data.application_units[i].unit_id);var j=0;if(paramCnt)paramCnt.items.each(function(c){var v=component.appl_data.application_units[i].application_unit_params[j]; setComponentValues(c,v);j++})}}}if(!component.appl_data.application_explain_documents||component.appl_data.application_explain_documents.length==0){var docExplainPanel=Ext.getCmp(component.docExplainPanelId);if(docExplainPanel){docExplainPanel.destroy();component.doLayout()}}if(component.appl_data&&(!!component.appl_data.eds_info||!!component.appl_data.eds_info_all)){component.add({xtype:"fieldset",title:"\u041f\u043e\u0434\u043f\u0438\u0441\u044c",hidden:!!(component.parent.totalParts==2&&component.parent.current_stage_number== 1),html:component.appl_data.eds_info_all?component.appl_data.eds_info_all.join("
"):component.applic_data.eds_info});component.doLayout()}if(component.mode=="view"||!!component.noneditable){var add_suppliers_cmp={xtype:"container",id:component.ids["suppliers_panel"],items:[]};if(!!applic_data.parts[0].enable_application_suppliers&&!!applic_data["suppliers"]&&applic_data["suppliers"].length>0&&applic_data["application_stages"]==1){Ext.each(applic_data["suppliers"],function(current_supplier){add_suppliers_cmp.items.push({xtype:"Application.components.keyValuePanel", border:false,margin:0,padding:0,style:"margin: 15px 0 0 0; padding: 0",captionCls:"no-th",fields:{full_name:"\u041f\u043e\u043b\u043d\u043e\u0435 \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438:",inn:"\u0418\u041d\u041d:",kpp:"\u041a\u041f\u041f:",legal_address:"\u042e\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u0434\u0440\u0435\u0441:",postal_address:"\u041f\u043e\u0447\u0442\u043e\u0432\u044b\u0439 \u0430\u0434\u0440\u0435\u0441:", phone:"\u041a\u043e\u043d\u0442\u0430\u043a\u0442\u043d\u044b\u0439 \u0442\u0435\u043b\u0435\u0444\u043e\u043d:"},values:current_supplier})});component.items.get(0).add(add_suppliers_cmp);component.items.get(0).setTitle("\u0417\u0430\u044f\u0432\u043a\u0430 \u043f\u043e\u0434\u0430\u0435\u0442\u0441\u044f \u0433\u0440\u0443\u043f\u043f\u043e\u0439 \u043b\u0438\u0446");component.items.get(0).doLayout()}else;if(applic_data&&applic_data.date_published){var date_published=Ext.getCmp("date_published"); var time_published=Ext.getCmp("time_published");if(typeof date_published!=="undefined"){var saved_date=parseDate(component.appl_data.date_published);if(!component.parent.simpleEdit)date_published.disable();if(typeof time_published!=="undefined"){time_published.setValue(saved_date);if(!component.parent.simpleEdit)time_published.disable()}}}if(!applic_data["user_digitalpoa_id"]){var digitalPoaCmp=Ext.getCmp(component.ids["digitalPoa_cmp"]);if(!!digitalPoaCmp)digitalPoaCmp.hide()}}if(component.parent.lot_data["lot_step"]== "correction"&&Ext.getCmp(component.ids["suppliers_panel"]))if(isEmpty(applic_data["suppliers"]))Ext.getCmp(component.ids["suppliers_panel"]).hide();var add_price_registration_cmp=Ext.getCmp(component.ids.add_price_registration_cmp);if(applic_data["application_stages"]==1&&add_price_registration_cmp&&(!isEmpty(component.appl_data.add_price)||component.parent.lot_data["status"]==Application.models.Procedure.statuses.add_price_registration)){add_price_registration_cmp.show();add_price_registration_cmp.setDisabled(false)}if(!!applic_data["is_additional_supplier"]){var warningCmp= Ext.getCmp(component.ids.warning_cmp);if(warningCmp)warningCmp.hide()}},afterLotLoaded:function(){if(!component.parent.lot_data)component.parent.lot_data={};var units=component.parent.lot_data.lot_units;if(!units||units.length==0)Ext.getCmp(this.ids.app_units_display).destroy();if(component.partDocReqs&&component.partDocReqs.length==0){var cmp_req_docs_part_1=Ext.getCmp("req_docs_part_1");if(cmp_req_docs_part_1)cmp_req_docs_part_1.destroy()}var warningText="";var procTypesToCheck=[PROCEDURE_TYPE_AUC_ASC, PROCEDURE_TYPE_AUC_DESC,PROCEDURE_TYPE_TENDER,PROCEDURE_TYPE_QUOTATION_REQ,PROCEDURE_TYPE_PRICELIST_REQ];var fee=component.parent.fee_information&&component.parent.fee_information["require"]||false;if(isSupplier()){var showMessage=!Main.config.negative_block_for_any_procedure;warningText="\u0412\u0430\u0448\u0430 \u0437\u0430\u044f\u0432\u043a\u0430 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u0434\u0430\u043d\u0430. \u041d\u0430 \u0432\u0430\u0448\u0435\u043c \u0441\u0447\u0435\u0442\u0435 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432 \u0434\u043b\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0443\u0447\u0430\u0441\u0442\u0438\u044f \u0432 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435/\u043e\u043f\u043b\u0430\u0442\u044b \u0443\u0441\u043b\u0443\u0433 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u0420\u0435\u0433\u043b\u0430\u043c\u0435\u043d\u0442\u043e\u043c \u0440\u0430\u0431\u043e\u0442\u044b \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043b\u043e\u0449\u0430\u0434\u043a\u0438. \u041f\u0440\u0438 \u043f\u043e\u0434\u0430\u0447\u0435 \u0437\u0430\u044f\u0432\u043a\u0438 \u043d\u0430 \u0441\u0447\u0435\u0442\u0435 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0441\u0443\u043c\u043c\u0430 \u0432 \u0440\u0430\u0437\u043c\u0435\u0440\u0435 {0} \u0440\u0443\u0431\u043b\u0435\u0439.
\u0423\u0431\u0435\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043f\u0440\u043e\u0441\u044c\u0431\u0430, \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u0434\u0435\u043d\u0435\u0436\u043d\u044b\u0435 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 \u0437\u0430\u0440\u0430\u043d\u0435\u0435, \u0434\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u0435\u043c\u0430 \u0437\u0430\u044f\u0432\u043e\u043a."; var warningParams={xtype:"fieldset",hideTitle:true,style:"margin: 5px; background-color: red;border: none; color: #fff",anchor:"100%",border:false,layout:"anchor",hidden:true,id:component.ids.warning_cmp,warningTemplate:warningText};if(fee&&showMessage&&!component.parent.noneditable&&component.parent.fee_information&&component.parent.fee_information["available"]=0&&component.parent.procedure_data.second_stage_access_step=="second_stage")&&in_array(component.parent.procedure_type,[PROCEDURE_TYPE_TENDER,PROCEDURE_TYPE_AUC_DESC])&&component.parent.totalParts>1&&!component.parent.noneditable){warningText='\u041f\u0435\u0440\u0432\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0437\u0430\u044f\u0432\u043a\u0438 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u0430 \u0441\u043e\u0434\u0435\u0440\u0430\u0436\u0430\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0434\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430 \u0438 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0442\u043e\u0440\u0443 \u0442\u043e\u0440\u0433\u043e\u0432 \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 "\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u0435 \u0437\u0430\u044f\u0432\u043e\u043a"'; component.add({xtype:"fieldset",hideTitle:true,style:"margin: 5px; background-color: red;border: none; color: #fff",anchor:"100%",border:false,layout:"anchor",html:String.format(warningText,Ext.util.Format.price(fee))})}if(component.mode!="view"&&!component.noneditable&&component.parent.totalParts==1&&component.parent.procedure_type!=PROCEDURE_TYPE_PRICELIST)component.add({xtype:"Application.components.ApplicationSuppliersFieldset",name:"application_suppliers",id:component.ids["suppliers_panel"]}); component.doLayout()}}});Application.components.ApplicFirstPartEditTab.superclass.initComponent.call(this)},validate:function(){if(Main.config.allow_single_unit&&this.parent.lot_data.single_unit&&this.parent.lot_data.unit_price)this.parent.lot_data.start_price=this.parent.lot_data.unit_price;if(this.parent&&Application.models.Procedure.groups.price_requested.indexOf(this.parent.procedure_type)>=0)if(!(this.parent.procedure_type==PROCEDURE_TYPE_QUOTATION_REQ&&!this.parent.lot_data.start_price)){var price= Ext.getCmp(this.ids.price);if(!this.parent.procedure_data.price_increase&&price&&price.getValue()>this.parent.lot_data.start_price&&this.parent.lot_data.start_price)if(!Main.config.price_increase_for_org_inns||Main.config.price_increase_for_org_inns.indexOf(this.parent.procedure_data.org_inn)<0)return{success:false,msg:"\u0426\u0435\u043d\u0430 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0435\u0442 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0443\u044e \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u0446\u0435\u043d\u0443 \u043b\u043e\u0442\u0430, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u0443\u044e \u0432 \u0438\u0437\u0432\u0435\u0449\u0435\u043d\u0438\u0438", fatal:true}}return true},buildForm:function(){var items=[];var component=this;items.push(this.getPartNumberHiddenField(this.partNumber));var applicTextCnt={xtype:"textarea",anchor:"100%",style:"height: 180px;",readOnly:true,name:"application_text",id:"application_text"};items.push({xtype:"fieldset",id:"fieldset_application_text",title:"\u0421\u043e\u0433\u043b\u0430\u0441\u0438\u0435 \u043d\u0430 \u043f\u043e\u0441\u0442\u0430\u0432\u043a\u0443, \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442, \u043e\u043a\u0430\u0437\u0430\u043d\u0438\u0435 \u0443\u0441\u043b\u0443\u0433", style:"margin: 5px",anchor:"100%",layout:"anchor",items:[applicTextCnt],hidden:component.parent.procedure_type==PROCEDURE_TYPE_PRICELIST});items.push({xtype:"fieldset",id:this.ids.small_business_first_parts_panel,name:"small_business_first_parts_panel",title:"\u041f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u043d\u043e\u0441\u0442\u044c \u043a \u043c\u0430\u043b\u043e\u043c\u0443 \u0438 \u0441\u0440\u0435\u0434\u043d\u0435\u043c\u0443 \u043f\u0440\u0435\u0434\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0443", style:"margin: 5px; padding: 5px",hidden:true,items:[]});items.push(this.getUnitParamFieldset());items.push(this.getDocumentFieldset("req_docs_part_1","\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b, \u0437\u0430\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0442\u043e\u0440\u043e\u043c \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u0437\u0430\u043a\u0443\u043f\u043a\u0438 \u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0437\u0430\u044f\u0432\u043a\u0438")); var docOtherPanel=this.getDocumentFieldset(this.docOtherPanelId,"\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b");docOtherPanel.items.push(this.constructDocumentUploadPanel("application_docs_other",APPLIC_DOC_OTHER,1,undefined));items.push(docOtherPanel);if(Main.config.applic_show_explain_docs&&this.noneditable){var docExplainPanel=this.getDocumentFieldset(this.docExplainPanelId,"\u0420\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0437\u0430\u044f\u0432\u043a\u0438"); docExplainPanel.items.push(this.constructDocumentUploadPanel("application_explain_documents",undefined,undefined,undefined));items.push(docExplainPanel)}return items},getUnitParamFieldset:function(){return{xtype:"fieldset",title:"\u0425\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0445 \u0442\u043e\u0432\u0430\u0440\u043e\u0432",id:this.ids.app_units_display,items:[]}},getUnitPositionFieldset:function(){var myReaderMap= Ext.data.Record.create([{name:"id",mapping:0},{name:"pos_number",mapping:1},{name:"name",mapping:2},{name:"quantity",mapping:3},{name:"okei_symbol",mapping:4},{name:"price",mapping:5},{name:"price_nds",mapping:6}]);var myReader=new Ext.data.ArrayReader({id:0},myReaderMap);var store=new Ext.data.Store({autoDestroy:true,reader:myReader});var dataGridColumns=[{header:"",width:20,dataIndex:"addme",xtype:"checkcolumn",checked:false},{header:"\u2116",width:30,dataIndex:"pos_number"},{header:"\u041d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435", dataIndex:"name"},{header:"\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e",width:60,editor:Ext.ux.helpers.textEdit(),dataIndex:"quantity"},{header:"\u0426\u0435\u043d\u0430 \u0437\u0430 \u0435\u0434\u0438\u043d\u0438\u0446\u0443 (\u0411\u0435\u0437 \u041d\u0414\u0421)",width:80,editor:Ext.ux.helpers.textEdit(),dataIndex:"price"},{header:"\u041e\u0431\u0449\u0430\u044f \u0446\u0435\u043d\u0430 (\u0411\u0435\u0437 \u041d\u0414\u0421)",width:80,editor:Ext.ux.helpers.textEdit(),dataIndex:"price_nds"}]; var posGrid=new Ext.grid.EditorGridPanel({id:this.ids.app_units_position_grid,store:store,viewConfig:{forceFit:true},columns:dataGridColumns,autoHeight:true,hideTitle:true,border:true,name:"pos_list",getValues:function(){var values=[];var modified=this.store.modified;for(var i=0;i 0){var paramPanel={hideTitle:true,id:"application_unit_params_"+unit.id,defaults:{layout:"form",labelWidth:300,allowBlank:false,anchor:"100%"},frame:false,items:[],getValues:function(){var v={};collectComponentValues(this,v,false);return v}};for(var n=0;n=0;var is_peretorg=!!Application.models.Lot.isPeretorg(lotData.lot);Ext.getCmp(first_part_id).parent=component;firstPartComponent.updateTitle();if(component.totalParts===2){component.unhideTabStripItem(firstPartComponent);component.unhideTabStripItem(secondPartComponent); Ext.getCmp(second_part_id).parent=component;if(is_bg_enabled&&is_bg_capable)Ext.getCmp(second_part_id).add(this.createGuaranteePanelComponent(2,is_peretorg||false,is_paper_procedure,lotData.lot));else if(is_bg_enabled&&is_bg_capable&&component.noneditable)Ext.getCmp(first_part_id).add(this.createGuaranteePanelComponent(1,false,false,lotData.lot))}else{Ext.getCmp(second_part_id).destroy();component.unhideTabStripItem(firstPartComponent);if(is_bg_enabled&&is_bg_capable)Ext.getCmp(first_part_id).add(this.createGuaranteePanelComponent(1, false,is_paper_procedure,lotData.lot))}if(component.application_id){var application_params={application_id:component.application_id,filter:component.filter};if(!!component.original)application_params.original_application=true;performRPCCall(RPC.Applic.loaddraft,[application_params],null,function(resp){if(resp&&resp.success){var applic_data=resp.applic;if(applic_data.parts){if(applic_data.parts[0]&&!applic_data.parts[0].phone)applic_data.parts[0].phone="\u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043e"; if(applic_data.parts[1]&&!applic_data.parts[1].phone)applic_data.parts[1].phone="\u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043e"}var simpleEditEnabled=isAdmin()&&!!Main.config.paper_applic_correction_allowed_steps[component.lot_data.lot_step]&&Main.config.paper_applic_correction_allowed_steps[component.lot_data.lot_step].indexOf(component.procedure_data.procedure_type)>=0&&!applic_data.reject_stage&&6!==applic_data.status;if(simpleEditEnabled){component.apiFunction=RPC.Applic.saveAdmin;component.simpleEdit= true;if(!applic_data["is_additional_supplier"])component.addButton({text:"\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c",handler:function(){component.performSave(function(){redirect_to("com/applic/viewapplics/lot/"+component.lot_data.id)})}});component.doLayout()}component.fireEvent("applicloaded",applic_data)}else if(resp)echoResponseMessage(resp);var guarantee_type_component=Ext.getCmp(component.shared_ids.guarantee_type);if(guarantee_type_component)guarantee_type_component.setValue(applic_data.guarantee_type)})}else component.loadApplicBySupplier(lotData, Main.contragent.id);if(component.noneditable||isCustomer()&&!isSupplier())Ext.getCmp(component.lot_panel_id).destroy()},disableEditableFields:function(skip_disabled_fieldsets){skip_disabled_fieldsets=skip_disabled_fieldsets||["\u0426\u0435\u043d\u0430 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f"];if(firstPartComponent&&firstPartComponent.items)firstPartComponent.items.each(function(cmp){if(!in_array(cmp.title,skip_disabled_fieldsets))cmp.disable()});if(secondPartComponent&& secondPartComponent.items)secondPartComponent.items.each(function(cmp){if(!in_array(cmp.title,skip_disabled_fieldsets))cmp.disable()});if(component.pricePartComponent&&component.pricePartComponent.items)component.pricePartComponent.items.each(function(cmp){if(!in_array(cmp.title,skip_disabled_fieldsets))cmp.disable()})},applicloaded:function(applic_data){component.applic=applic_data;component.lot_id=applic_data.lot_id;component.procedure_id=applic_data.procedure_id;if(component.mode!="view")if(applic_data.lot["status"]== Application.models.Procedure.statuses.add_price_registration)component.fireEvent("disableEditableFields",["\u041f\u043e\u0434\u0430\u0447\u0430 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0439","\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f"]);else{if(component.procedure_data["frm"]==="peretorg")component.fireEvent("disableEditableFields",["\u0426\u0435\u043d\u0430 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f"])}else if(Ext.getCmp(component.shared_ids.guarantee_form))Ext.getCmp(component.shared_ids.guarantee_form).hide(); if(component.totalParts==2)if((applic_data.supplier_id!=Main.user.contragent_id&&!applic_data["is_additional_supplier"]&&!applic_data.second_part_visible||component.lot_data.status<4&&isAdmin()||component.lot_data.status>=6&&!(component.applic.parts[1]||component.lot_data.lot_step==="second_parts")||component.applic["second_part_visible"]===false||applic_data.supplier_id!==Main.user.contragent_id&&!applic_data["is_additional_supplier"]&&component.lot_data.status>=6&&component.applic.status==2)&&component.lot_data.status!== 10&&!(Application.models.Procedure.groups.second_stage_acccess_managed.indexOf(applic_data.procedure.procedure_type)>=0&&applic_data.procedure.second_stage_access_step=="second_stage")){var guarantee_form_component=Ext.getCmp(component.shared_ids.guarantee_form);Ext.getCmp(second_part_id).destroy();if(component.pricePartComponent)component.pricePartComponent.destroy();if(guarantee_form_component){Ext.getCmp(component.first_part_id).add(this.createGuaranteePanelComponent(1,false,false,component.lot_data)); component.doLayout()}}if(component.noneditable)if(component.applic.parts[0]["application_docs"]&&component.applic.parts[0].application_docs.length>0||component.applic.parts[0].application_docs_other&&component.applic.parts[0].application_docs_other.length>0||component.applic.parts[0].application_docs_price_other&&component.applic.parts[0].application_docs_price_other.length>0||component.applic.parts[1]&&component.applic.parts[1].application_docs&&component.applic.parts[1].application_docs.length> 0||component.applic.parts[1]&&component.applic.parts[1].application_docs_other&&component.applic.parts[1].application_docs_other.length>0)Ext.getCmp(zip_button_id).show();if(component.mode=="view"&&component.applic.lot.status==Application.models.Procedure.statuses.first_parts&&component.applic.procedure.procedure_type==Application.models.Procedure.type_ids.auction_up_26)Ext.getCmp(zip_button_id).hide();if(!!applic_data["is_additional_supplier"]){var cmp=Ext.getCmp(save_id);if(cmp)cmp.hide();if(!!applic_data["suppliers"]&& !isEmpty(applic_data["suppliers"]))Ext.iterate(applic_data["suppliers"],function(supplierInfo){if(supplierInfo["supplier_id"]===Main.contragent.id&&supplierInfo["status"]>0){var signCmp=Ext.getCmp(sign_id);if(signCmp)signCmp.hide()}})}if(component.mode!="view")if(component.lot_data["status"]==Application.models.Procedure.statuses.add_price_registration)component.fireEvent("disableEditableFields",["\u041f\u043e\u0434\u0430\u0447\u0430 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0439", "\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f"]);else{if(component.procedure_data["frm"]==="peretorg")component.fireEvent("disableEditableFields",["\u0426\u0435\u043d\u0430 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f"])}else if(Ext.getCmp(component.shared_ids.guarantee_form))Ext.getCmp(component.shared_ids.guarantee_form).hide();component.fireEvent("idchanged",applic_data.id);component.fireEvent("cmpready")},cmpready:function(){if(Main.config.extended_applic_registration_quotation&& [3,4,6,9].indexOf(this.lot_data.status)>=0)return;if(!this.noneditable&&[Application.models.Procedure.statuses.published,Application.models.Procedure.statuses.signed,Application.models.Procedure.statuses.correction,Application.models.Procedure.statuses.applic_opened,Application.models.Procedure.statuses.final_registration,Application.models.Procedure.statuses.app_discussion,Application.models.Procedure.statuses.paused,Application.models.Procedure.statuses.add_price_registration].indexOf(this.lot_data.status)< 0&&isSupplier()){if(Main.config.allow_participant_docs_update&&[Application.models.Procedure.statuses.trade,Application.models.Procedure.statuses.second_parts].indexOf(this.lot_data.status)>=0&&this.applic&&(this.applic.date_accepted||1==this.applic.status)&&this.applic.actual&&this.applic.procedure&&2==this.applic.procedure.application_stages){callComponents([first_part_id],function(c){c.disable()});this.activate(second_part_id);Ext.getCmp(second_part_id).setMode("updatefiles");callComponents([save_id, sign_id],function(c){c.hide()});Ext.getCmp(update_id).show();return}Ext.Msg.alert("\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435","\u041f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430 \u043d\u0435 \u0432 \u0441\u0442\u0430\u0442\u0443\u0441\u0435 \u043f\u0440\u0438\u0435\u043c\u0430 \u0437\u0430\u044f\u0432\u043e\u043a, \u043f\u043e\u0434\u0430\u0447\u0430 \u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u044f\u0432\u043e\u043a \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0430"); callComponents([save_id,sign_id,first_part_id,second_part_id],function(c){c.disable()})}if(component.mode!="view"&&isCustomer()&&!isSupplier()&&Main.config.allow_customer_add_applic){var fp=Ext.getCmp(first_part_id);if(undefined!==Ext.getCmp(fp.ids.app_units_display))Ext.getCmp(fp.ids.app_units_display).hide();var dop=Ext.getCmp(fp.ids.docOtherPanelId).findParentByType("fieldset");dop.destroy();Ext.getCmp("fieldset_application_text").hide()}}},getValues:function(){var values={lot_id:component.lot_id}; collectComponentValues(this,values,true);if(this.application_id)values.id=this.application_id;return values}});Application.components.ApplicForm.superclass.initComponent.call(this);if(this.value)autoSetValue(this);else{this.on("beforerender",function(){Ext.getCmp(this.lot_panel_id).relayEvents(this,["lotloaded"]);Ext.getCmp(first_part_id).relayEvents(this,["lotloaded","applicloaded"]);Ext.getCmp(second_part_id).relayEvents(this,["lotloaded","applicloaded"]);if(!this.noneditable){var backButton={text:"\u041d\u0430\u0437\u0430\u0434", handler:function(){var redirect="po/applic/openapplics/lot/"+component.lot_id+"/stage/"+component.stage;if(Main.config.applic_create_redirect)redirect=Main.config.applic_create_redirect.replace("%lot_id%",component.lot_id);redirect_to(redirect)},scope:this};var saveButton={text:"\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c",id:save_id,handler:function(){component.performSave()},scope:this};var cancelButton={text:"\u0417\u0430\u043a\u0440\u044b\u0442\u044c",handler:function(){redirect_to("com/applic/openapplics/lot/"+ component.lot_id+"/stage/"+component.stage)}};var saveAndNextButton={text:"\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0437\u0430\u044f\u0432\u043a\u0430",handler:function(){component.performSave(function(){redirect_to(component.module+"/applic/create/lot/"+component.lot_id)})},scope:this};var signButton={text:"\u041f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c \u0438 \u043d\u0430\u043f\u0440\u0430\u0432\u0438\u0442\u044c",id:sign_id,handler:function(){var values=component.getValues(); if(values.parts&&values.parts.length){var lastPart=values.parts[values.parts.length-1];var partsPrice=lastPart.price||values.price;if((lastPart.price===null||values.price===null)&&component.procedure_data.procedure_type!=PROCEDURE_TYPE_PRICELIST){Ext.MessageBox.alert("\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435","\u041e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0446\u0435\u043d\u0443 \u0412\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u0432\u0430\u043b\u044e\u0442\u0435 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0439 \u0446\u0435\u043d\u044b \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"); return false}if(lastPart.price<0||values.price<0){Ext.MessageBox.alert("\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435","\u0426\u0435\u043d\u0430 \u0412\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0443\u043b\u044f");return false}if(lastPart.add_price===null||values.add_price===null){alertWarning("\u041e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0446\u0435\u043d\u0443 \u0432\u0430\u0448\u0435\u0433\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u0432\u0430\u043b\u044e\u0442\u0435 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0439 \u0446\u0435\u043d\u044b \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"); return false}if(lastPart.add_price<0||values.add_price<0){Ext.MessageBox.alert("\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435","\u0426\u0435\u043d\u0430 \u0412\u0430\u0448\u0435\u0433\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0443\u043b\u044f"); return false}if(lastPart.enable_application_suppliers&&lastPart.application_suppliers&&lastPart.application_suppliers.length==0){alertWarning('\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a\u043e\u043d\u0442\u0440\u0430\u0433\u0435\u043d\u0442\u0430 \u0433\u0440\u0443\u043f\u043f\u044b \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 "\u0417\u0430\u044f\u0432\u043a\u0430 \u043e\u0442 \u0433\u0440\u0443\u043f\u043f\u044b \u043b\u0438\u0446".'); return false}if(lastPart.user_digitalpoa_id!==undefined&&Main.user.eds_type==EDS_TYPE_PERSONAL&&!lastPart.user_digitalpoa_id){alertWarning("\u041e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0434\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u041c\u0427\u0414");return false}if(component.procedure_data)if(component.procedure_data.price_increase&&in_array(component.procedure_data.procedure_type,[PROCEDURE_PRICE_REQUEST, PROCEDURE_CONCURRENT_PROCEDURE])){if(partsPrice&&component.lot_data.start_price>partsPrice){alertWarning("\u0426\u0435\u043d\u0430 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0432\u044b\u0448\u0435 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0446\u0435\u043d\u044b \u043b\u043e\u0442\u0430");return false}}else{if(partsPrice&&component.lot_data.start_price< partsPrice){alertWarning("\u0426\u0435\u043d\u0430 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u044b\u0448\u0435 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0446\u0435\u043d\u044b \u043b\u043e\u0442\u0430");return false}var addPrice=values.parts[values.parts.length-1].add_price||values.add_price;if(component.applic&& addPrice&&component.applic.price\n");if(warn_fatal){Ext.Msg.alert("\u041e\u0448\u0438\u0431\u043a\u0430",warn);return}else Ext.Msg.confirm("\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435",warn+"
\n\u0412\u044b \u0443\u0432\u0435\u0440\u0435\u043d\u044b \u0447\u0442\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u043e\u0434\u0430\u0442\u044c \u0437\u0430\u044f\u0432\u043a\u0443?", function(b){if("yes"==b)doSave()})}else doSave()})},scope:this};var updateButton={text:"\u041e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e",id:update_id,hidden:true,handler:function(){component.performSave(null,"updatefiles")}};if(Main.config.fluent_applic_enable)this.addButton(backButton);this.addButton(saveButton);if(isCustomer()&&!isSupplier())this.addButton(cancelButton);if(Main.config.fluent_applic_enable)this.addButton(saveAndNextButton); if(isSupplier())this.addButton(signButton);this.addButton(updateButton)}else{Ext.getCmp(component.lot_panel_id).hidden=true;var zipButton={xtype:"button",text:"\u0421\u043a\u0430\u0447\u0430\u0442\u044c \u0432\u0441\u0435 \u0444\u0430\u0439\u043b\u044b \u0437\u0430\u044f\u0432\u043a\u0438 \u0432 \u0432\u0438\u0434\u0435 \u0430\u0440\u0445\u0438\u0432\u0430",id:zip_button_id,hidden:true,handler:function(){document.location.href="/applic/getzip/application_id/"+component.applic.id}};this.addButton(zipButton)}}, this);this.on("afterrender",function(){component.hideTabStripItem(firstPartComponent);component.hideTabStripItem(secondPartComponent);component.loadLotData(component.lot_id)},this)}},eachPart:function(cb){this.items.each(function(i){if(i.partNumber)cb(i)})},performSave:function(cb,mode){var component=this,values=component.getValues(),apiFunction=!!component.apiFunction?component.apiFunction:RPC.Applic.save;values.lot_id=component.lot_id;values.procedure_id=component.procedure_id;values.application_id= component.application_id;if(mode)values.mode=mode;performRPCCall(apiFunction,[values],null,function(result){if(result.success){if(result.applic){component.applic=result.applic;component.application_id=result.applic.id;echoResponseMessage(result);if(result.redirect_url)redirect_to(result.redirect_url)}else if(result.application_id)component.fireEvent("idchanged",result.application_id);if(cb)cb(result)}else echoResponseMessage(result)})},loadLotData:function(lot_id){var component=this;Ext.getBody().mask("\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435"); RPC.Lot.load(lot_id,function(resp){if(resp.success){var lotData=resp.procedure;if(resp.is_additional_supplier){Ext.getCmp(component.first_part_id).noneditable=resp.is_additional_supplier;Ext.getCmp(component.second_part_id).noneditable=resp.is_additional_supplier}component.fireEvent("lotloaded",lotData);Ext.getBody().unmask()}else{echoResponseMessage(resp);Ext.getBody().unmask();redirect_to("com/procedure/index")}})},loadApplicBySupplier:function(lotData,supplier_id){var component=this;var values= {};var lot_id=lotData.lot.id;values.supplier_id=supplier_id;values.lot_id=lot_id;performRPCCall(RPC.Applic.loaddraft,[values],null,function(resp){if(resp.credit_available)component.credit_available=resp.credit_available;if(resp.fee_information){component.fee_information=resp.fee_information;Ext.getCmp(component.first_part_id).updateWarningStatus()}if(resp&&resp.success){var applic_data=resp.applic;component.fireEvent("applicloaded",applic_data)}else{if(resp.message)echoResponseMessage(resp);component.fireEvent("cmpready")}})}, createGuaranteePanelComponent:function(part_number,force_readonly,hide_guarantee_fields,lot_data){var component=this;var part_number=part_number||1;var force_readonly=force_readonly||false;var hide_guarantee_fields=hide_guarantee_fields||false;var panel={xtype:"Application.components.guaranteeDataPanel",document_id:"application_docs_guarantee",guarantee_type:component.shared_ids.guarantee_type,hide_guarantee_fields:hide_guarantee_fields,noneditable:force_readonly||(component.noneditable||component.additional), component:component,part:part_number,force_readonly:force_readonly,id:component.shared_ids.guarantee_form};if(!!lot_data.bank_guarantee&&!lot_data.use_payments_to_etp_account&&!lot_data.use_payments_to_customer_account&&!lot_data.small_biz_only)panel.combo_values=[["2","\u041e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u0435 \u0437\u0430\u044f\u0432\u043a\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u043f\u043e \u0444\u043e\u0440\u043c\u0435 \u0431\u0430\u043d\u043a\u043e\u0432\u0441\u043a\u043e\u0439 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0438"]]; return panel}});Ext.define("Application.components.ApplicGrid",{extend:"Ext.grid.GridPanel",frame:true,border:false,id:"ApplicGrid",initComponent:function(){this.addEvents("search");var component=this;var advFields=[];var storeParams={};var actionLinks=[];if(component.companyType=="my"){advFields.push("registry_number");advFields.push("order_number_assigned");Ext.apply(storeParams,{contragent_type:component.companyType});actionLinks=[{tooltip:"\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c", icon:"/ico/applics/create_applic.png",handler:redirectActionHandler("com/applic/create/lot/{lot_id}/procedure/{procedure_id}/additional/{is_additional_supplier}"),isHidden:function(v,meta,rec){return!(rec.data.status==0||rec.data.status==null)}},{tooltip:"\u041f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c",icon:"/ico/settings/browse.png",handler:redirectActionHandler("com/applic/view/id/{id}/lot_id/{lot_id}"),isHidden:function(v,meta,rec){return false}},{tooltip:"\u041f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c", icon:"/ico/applics/sign_applic.png",handler:redirectActionHandler("com/applic/edit/procedure/{procedure_id}/lot/{lot_id}/application_id/{id}"),isHidden:function(v,meta,rec){return!(rec.data.status==0)}},{tooltip:"\u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044c \u0437\u0430\u044f\u0432\u043a\u0443 \u043d\u0430 \u0443\u0447\u0430\u0441\u0442\u0438\u0435",icon:"/ico/applics/create_applic.png",isHidden:function(v,meta,rec){if([1,7].indexOf(rec.data.status)==-1)return true;if(rec.data.lot_status!= Application.models.Procedure.statuses.published)return true;return!(rec.data.is_additional_supplier==true)},handler:redirectActionHandler("com/applic/create/lot/{lot_id}/procedure/{procedure_id}/additional/{is_additional_supplier}"),lotHref:"com/applic/create/lot/{lot_id}/procedure/{procedure_id}/additional/{is_additional_supplier}"},{tooltip:"\u0421\u0442\u0430\u0442\u0443\u0441 \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u0437\u0430\u044f\u0432\u043a\u0438 \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u0430\u043c\u0438", icon:"/images/icons/silk/application_form_magnify.png",pseudo:"additional_suppliers",isHidden:function(v,meta,rec){if([1,7].indexOf(rec.data.status)==-1)return true;return!(rec.data.is_additional_supplier==true)},handler:function(grid,rowIndex,colIndex,item,e,lot){var item=grid.getAt(rowIndex);if(!item||!item.data)return;return showAdditionalSuppliersStatusByLotData(item.data.lot_id,item.data.lot_number,item.data.registry_number)}},{tooltip:"\u041e\u0442\u043e\u0437\u0432\u0430\u0442\u044c \u0437\u0430\u044f\u0432\u043a\u0443", icon:"/ico/applics/withdraw_applic.png",handler:redirectActionHandler("com/applic/cancel/id/{id}"),isHidden:function(v,meta,rec){if(rec.data.frm&&rec.data.lot_status<7)return true;if(!!rec.get("is_additional_supplier"))return true;return!([1,7].indexOf(rec.data.status)>-1&&[Application.models.Procedure.statuses.published,Application.models.Procedure.statuses.app_discussion].indexOf(rec.data.lot_status)>-1||rec.data.order_number_assigned&&rec.data.order_number_assigned>3&&rec.data.status==3)}},{tooltip:"\u041e\u0442\u043e\u0437\u0432\u0430\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0446\u0435\u043d\u043e\u0432\u043e\u0435 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435", icon:"/ico/applics/withdraw_applic.png",handler:redirectActionHandler("com/applic/cancel/id/{id}"),isHidden:function(v,meta,rec){if(Application.models.Procedure.statuses.add_price_registration==rec.get("lot_status")&&rec.get("is_additional_apply")==true)return false;return true}},{tooltip:"\u0423\u0434\u0430\u043b\u0438\u0442\u044c",icon:"/ico/delete.png",handler:function(grid,rowIndex){Ext.Msg.confirm("\u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435","\u0412\u044b \u0443\u0432\u0435\u0440\u0435\u043d\u044b \u0447\u0442\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0437\u0430\u044f\u0432\u043a\u0443?", function(r){if("yes"==r){var item=grid.getAt(rowIndex);var template=new Ext.Template("com/applic/delete/id/{id}");if(item)redirect_to(template.apply(item.data))}})},isHidden:function(v,meta,rec){return!(rec.data.status==0||rec.data.status==null)}}]}else{advFields.push("registry_number");advFields.push("supplier_name");advFields.push("procedure_type");Ext.apply(storeParams,{procedure_id:component.procedureId});actionLinks=[{tooltip:"\u041f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c", icon:"/ico/settings/browse.png",handler:redirectActionHandler("com/applic/view/id/{id}/lot_id/{lot_id}"),isHidden:function(v,meta,rec){if(rec.data.id===null||rec.data.lot_status==Application.models.Procedure.statuses.add_price_registration)return true;return false}},{tooltip:"\u041f\u043e\u0434\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u044f\u0432\u043a\u0438",icon:"/ico/applics/request.png", isHidden:function(v,meta,rec){return!(rec.data.lot_status==4&&(rec.data.procedure_type==1||rec.data.procedure_type==2||rec.data.procedure_type==3))},handler:redirectActionHandler("com/procedure/requestapplic/type/request/procedure/{procedure_id}/lot/{lot_id}/application/{id}")}]}var store=createApplicStore(component.directFn,storeParams,advFields);function dateRenderer(v,m,rec,n,f){if(rec.data.status<1||rec.data.status==7)return"\u2014";return Ext.util.Format.date(v,"d.m.Y")}function timeRenderer(v, m,rec,n,f){if(rec.data.status<1||rec.data.status==7)return"\u2014";return Ext.util.Format.date(v,"H:i")}var tbar;if(component.companyType=="my")tbar={xtype:"Application.components.searchToolbar",eventTarget:this,searchHelp:"\u0411\u044b\u0441\u0442\u0440\u044b\u0439 \u043f\u043e\u0438\u0441\u043a \u043f\u043e \u0437\u0430\u044f\u0432\u043a\u0430\u043c",advancedSearch:[{xtype:"textfield",name:"registry_number",fieldLabel:"\u0420\u0435\u0435\u0441\u0442\u0440\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b"}, {xtype:"combo",name:"status",defaultValue:-1,fieldLabel:"\u0421\u0442\u0430\u0442\u0443\u0441 \u0437\u0430\u044f\u0432\u043a\u0438",mode:"local",store:new Ext.data.ArrayStore({id:0,fields:["id","name"],data:[[-1,"\u0412\u0441\u0435"],[0,"\u0427\u0435\u0440\u043d\u043e\u0432\u0438\u043a"],[1,"\u041f\u043e\u0434\u0430\u043d\u0430, \u043d\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0430"],[2,"\u041e\u0442\u043e\u0437\u0432\u0430\u043d\u0430 \u0434\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044f"], [3,"\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0430 \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u043e\u043c, \u043f\u0440\u0438\u043d\u044f\u0442\u0430"],[4,"\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0430 \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u043e\u043c, \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0430"],[5,"\u0418\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c \u0443\u043a\u043b\u043e\u043d\u0438\u043b\u0441\u044f \u043e\u0442 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"]]}), editable:false,valueField:"id",displayField:"name",hiddenName:"name",triggerAction:"all"}]};var cols=[];cols.push({header:"\u0420\u0435\u0435\u0441\u0442\u0440\u043e\u0432\u044b\u0439 \u2116",dataIndex:"registry_number",width:50});cols.push({header:"\u041d\u043e\u043c\u0435\u0440 \u043b\u043e\u0442\u0430",dataIndex:"lot_number",width:30});cols.push({header:"\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b",dataIndex:"procedure_title",width:150}); cols.push({header:"\u0414\u0430\u0442\u0430 \u043f\u043e\u0434\u0430\u0447\u0438",dataIndex:"date_added",width:40,renderer:dateRenderer});cols.push({header:"\u0412\u0440\u0435\u043c\u044f \u043f\u043e\u0434\u0430\u0447\u0438",dataIndex:"time_added",width:40,renderer:timeRenderer});cols.push({header:"\u0422\u0435\u043a\u0443\u0449\u0438\u0439 \u0441\u0442\u0430\u0442\u0443\u0441",dataIndex:"status_text",width:70});if(component.companyType!="my")cols.push({header:"\u041d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044f", dataIndex:"supplier_name",width:150});cols.push({header:"\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u0438",xtype:"textactioncolumn",actionsSeparator:" ",items:actionLinks,width:40,sortable:false});Ext.apply(this,{store:store,colModel:new Ext.grid.ColumnModel({defaults:{sortable:true},columns:cols}),viewConfig:{getRowClass:function(rec){return rec.data.status==0||rec.data.status==null?"x-color-3":""},forceFit:true},bbar:new Ext.PagingToolbar({pageSize:25,store:store,displayInfo:true,displayMsg:"\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 {0} - {1} \u0438\u0437 {2}", emptyMsg:"\u0421\u043f\u0438\u0441\u043e\u043a \u043f\u0443\u0441\u0442"}),tbar:tbar,sm:new Ext.grid.RowSelectionModel({singleSelect:true}),loadMask:true,listeners:{render:function(){this.fireEvent("search")},search:function(query,search_params){var store=this.getStore();if(this.companyType=="my"){if(search_params){var sp;for(sp in search_params)store.setBaseParam(sp,search_params[sp])}store.setBaseParam("query",query);store.setBaseParam("start",0);store.setBaseParam("limit",25)}store.load()}},getAt:function(rowIndex){return this.getStore().getAt(rowIndex)}}); Application.components.ApplicGrid.superclass.initComponent.call(this)}});Ext.define("Application.components.ApplicHistoryGridPanel",{extend:"Ext.grid.GridPanel",initComponent:function(){var component=this;var application_id=component.application_id;var store=getStore("applhistory_"+application_id,{directFn:RPC.Applic.history,paramsAsHash:true,groupField:"lot_id",remoteSort:true,autoLoad:true,baseParams:{application_id:application_id},reader:new Ext.data.JsonReader({root:"entries",totalProperty:"totalCount",fields:["field","from","to",{name:"date",type:"date",dateFormat:"c"}, "user"]})});Ext.apply(this,{store:store,columns:[{header:"\u0414\u0430\u0442\u0430 \u0432\u043d\u0435\u0441\u0435\u043d\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439",width:150,renderer:Ext.util.Format.dateRenderer("d.m.Y H:i"),dataIndex:"date"},{header:"\u041d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430",width:380,dataIndex:"field"},{header:"\u0421\u0442\u0430\u0440\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435", dataIndex:"from",width:200},{header:"\u041d\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435",dataIndex:"to",width:200}],viewConfig:{forceFit:true}});Application.components.ApplicHistoryGridPanel.superclass.initComponent.call(this)}});Application.components.ApplicPriceForm=Ext.extend(Ext.form.FieldSet,{title:"\u0426\u0435\u043d\u0430 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f",style:"margin: 5px;",defaults:{anchor:"100%"},xtype:"form",layout:"form",labelWidth:400,vat_percent:20,noneditable:false,priceAllowBlank:false,additional_items:[],noneditablePrice:false,fixVatCheckbox:false,parentCmp:null,config:{price_cmp_name:"price",price_without_vat_cmp_name:"price_without_vat"},initComponent:function(){var component= this;var vat_percent=component.vat_percent;var noneditablePrice=component.noneditablePrice;component.ids=initIds(["price","price_without_vat","nds_percent_id","nds_checkbox_id","minimal_price_id"]);var priceStyle=null;if(component.noneditable)priceStyle="background: transparent; border: none;";var priceButtons=[];var additional=component.config.price_cmp_name=="add_price";var procedureData=null;if(component.parentCmp&&component.parentCmp.procedure_data)procedureData=component.parentCmp.procedure_data; else if(component.ownerCt&&component.ownerCt.parent&&component.ownerCt.parent.procedure_data)procedureData=component.ownerCt.parent.procedure_data;if(procedureData){var is_customer=false;if(procedureData.lot&&procedureData.lot["lot_customers"]&&procedureData.lot["lot_customers"].length>0)Ext.iterate(procedureData.lot["lot_customers"],function(item){if(item&&item["id"]==Main.user.contragent_id)is_customer=true});var is_organizer=procedureData.organizer_contragent_id==Main.user.contragent_id;if(is_customer|| is_organizer||isAdmin())priceButtons.push({text:additional?"\u0421\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u043c \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0438":"\u0421\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e \u0446\u0435\u043d\u043e\u0432\u043e\u043c \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0438", hidden:isSupplier()&&!isCustomer(),handler:function(){var params={lot_id:component.lot_id,application_id:component.application_id,additional:additional};performAjaxRPCCall("/applic/generateSuggestion",params,{download:true,wait_disable:true})}})}var items=[{xtype:"hidden",name:"vat_percent",value:component.vat_percent},{xtype:"Application.components.priceField",name:component.config.price_cmp_name,id:component.ids.price,allowBlank:component.priceAllowBlank==="",disabled:noneditablePrice&&!component.simpleEdit|| component.noneditable,style:priceStyle,fieldLabel:"\u0426\u0435\u043d\u0430 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u0432\u0430\u043b\u044e\u0442\u0435 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0439 \u0446\u0435\u043d\u044b \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"+component.priceAllowBlank,listeners:{change:function(cmp){var cmp=this;var value=cmp.getValue();var price_without_vat_cmp=Ext.getCmp(component.ids.price_without_vat);if(!price_without_vat_cmp|| price_without_vat_cmp.hidden==true)return;if(vat_percent>0)price_without_vat_cmp.setValue(value/(1+vat_percent/100));else price_without_vat_cmp.setValue(value)}}},{xtype:"checkbox",name:"price_with_vat",hidden:!component.vat_percent,boxLabel:"\u0421 \u0443\u0447\u0435\u0442\u043e\u043c \u041d\u0414\u0421 (\u0441\u0442\u0430\u0432\u043a\u0430: "+(vat_percent==-1?"\u0421\u043e\u0441\u0442\u0430\u0432\u043d\u043e\u0439 \u041d\u0414\u0421":parseInt(vat_percent)+"%")+")",disabled:component.noneditable|| !component.vat_percent||component.fixVatCheckbox||noneditablePrice,checked:component.appl_data?component.appl_data.price_with_vat:true,listeners:{check:function(obj,v){if(noneditablePrice)this.setVisible(v);var nds_percent=Ext.getCmp(component.ids.price_without_vat);if(nds_percent){nds_percent.setVisible(v);nds_percent.setDisabled(!v)}if(!!v)Ext.getCmp(component.ids.price).fireEvent("change",Ext.getCmp(component.ids.price))},valueFilled:function(v){var nds_percent=Ext.getCmp(component.ids.nds_percent_id); if(nds_percent){nds_percent.setVisible(v);nds_percent.setDisabled(!v)}}}},{xtype:"Application.components.priceField",name:component.config.price_without_vat_cmp_name,id:component.ids.price_without_vat,allowBlank:component.priceAllowBlank==="",hidden:!component.vat_percent,disabled:noneditablePrice&&!component.simpleEdit||component.noneditable,style:priceStyle,fieldLabel:"\u0426\u0435\u043d\u0430 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u0432\u0430\u043b\u044e\u0442\u0435 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0439 \u0446\u0435\u043d\u044b \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430
\u0431\u0435\u0437 \u0443\u0447\u0435\u0442\u0430 \u041d\u0414\u0421"+ component.priceAllowBlank,listeners:{change:function(cmp){if(!cmp||!!cmp.hidden)return;var value=cmp.getValue();var price_cmp=Ext.getCmp(component.ids.price);if(!price_cmp||!price_cmp.isVisible())return;var currentPriceVAT=price_cmp.getValue();if(value!=currentPriceVAT){var newPriceWithVat=value+value*vat_percent/100;if(vat_percent>0&&Math.abs(newPriceWithVat-currentPriceVAT)>=.01)price_cmp.setValue(newPriceWithVat)}else{var newPriceNoVat=value/(1+vat_percent/100);cmp.setValue(newPriceNoVat)}}}}]; if(!isEmpty(component.additional_items))items.push({xtype:"container",items:component.additional_items});Ext.apply(component,{items:items,buttons:priceButtons});Application.components.ApplicPriceForm.superclass.initComponent.call(this)}});Application.components.ApplicSecondPartEditTab=Ext.extend(Application.components.ApplicEditTab,{frame:true,border:false,initComponent:function(){var component=this;component.ids=initIds(["contragent_info_panel","small_business_first_parts_panel","price","price_without_vat","add_price_panel","add_price_registration_cmp","price_panel","digitalPoa_cmp"]);component.docOtherPanelId=Ext.id();component.docPriceOtherPanelId=Ext.id();component.docAddPriceOtherPanelId=Ext.id();component.docPanelId="req_docs_part_2"; component.parent.max_sum_doc_needed=true;this.items=this.buildForm(this.partNumber);addEvents(this,["lotloaded","applicloaded"]);Ext.apply(this,{title:"\u0412\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0437\u0430\u044f\u0432\u043a\u0438",xtype:"panel",name:"parts[]",layout:"form",labelWidth:400,defaults:{allowBlank:false,minLengthText:"\u0421\u043b\u0438\u0448\u043a\u043e\u043c \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435",maxLengthText:"\u0421\u043b\u0438\u0448\u043a\u043e\u043c \u0434\u043b\u0438\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435", anchor:"100%",style:"margin: 5px"},monitorValid:true,autoHeight:true,items:this.items,listeners:{lotloaded:function(lotData){var docPanelId=component.docPanelId;if(component.parent.noneditable)component.mode="view";component.partDocReqs=component.setDocReqs(component.partNumber);if(component.parent.totalParts==2){var cmpDataPanel=this.createCmpDataPanel(component.ids.contragent_info_panel);this.insert(0,cmpDataPanel)}if(component.parent.lot_data.simple_requirements)Ext.getCmp(component.docOtherPanelId).insert(0, {html:"\u0417\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u043e\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u044b \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u043a \u043f\u0440\u0438\u043b\u0430\u0433\u0430\u0435\u043c\u044b\u043c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u043c:"},{xtype:"displayfield",width:"99%",value:Ext.util.Format.nl2br(component.parent.lot_data.simple_requirements)});var small_business_panel=Ext.getCmp(component.ids.small_business_first_parts_panel); if(small_business_panel){if(Main&&Main.contragent&&!Main.contragent.small_biz&&!isCustomer()&&component.mode!="view"&&(!lotData||!lotData.lot||lotData.lot.small_biz_only))small_business_panel.add({html:"\u0414\u0430\u043d\u043d\u0430\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0434\u043b\u044f \u0441\u0443\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043c\u0430\u043b\u043e\u0433\u043e \u0438 "+"\u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u043f\u0440\u0435\u0434\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0435\u0441\u043b\u0438 \u0432\u0430\u0448\u0430 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a \u0442\u0430\u043a\u0438\u043c \u0441\u0443\u0431\u044a\u0435\u043a\u0442\u0430\u043c, "+ '\u0432\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u043d\u0435\u0441\u0442\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u0430\u043a\u043a\u0440\u0435\u0434\u0438\u0442\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435.', cls:"spaced-bottom-shallow"});small_business_panel.add(component.createSmBusinessCheckBox(component,Main.contragent.small_biz));if(component.parent.procedure_type!=PROCEDURE_TYPE_AUC_ASC_26)small_business_panel.add(component.createBusinessDeclarationUploadPanel(component.partNumber));var declaration_panel=Ext.getCmp(component.parent.shared_ids.sm_business_declaration_id);if(declaration_panel&&component.parent.lot_data.small_biz_only)declaration_panel.setVisible(true)}if(!component.partDocReqs||component.partDocReqs.length== 0)callComponents([component.docPanelId],function(c){c.destroy()});else{for(var k=0;k= 0||Main.config.allow_customer_add_applic){if(!noneditablePrice)priceAllowBlank=REQUIRED_FIELD;if(Application.models.Procedure.groups.second_stage_acccess_managed.indexOf(component.parent.procedure_type)>=0&&component.parent.procedure_data.second_stage_access_step=="second_stage"||in_array(component.parent.procedure_type,[PROCEDURE_TYPE_TENDER,PROCEDURE_TYPE_PRICELIST_REQ,PROCEDURE_TYPE_QUOTATION_REQ,PROCEDURE_TYPE_PERETORG_REDUC,PROCEDURE_TYPE_PERETORG_TENDER,PROCEDURE_TYPE_PURCHASE_WITH_GRADE])){var docPriceOtherPanel= this.getDocumentFieldset(this.docPriceOtherPanelId,"\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b",!isEmpty(component.parent.procedure_data["frm"]));docPriceOtherPanel.items.push(this.constructDocumentUploadPanel("application_docs_price_other",APPLIC_DOC_PRICE_OTHER,2,undefined));var docAddPriceOtherPanel=this.getDocumentFieldset(this.docAddPriceOtherPanelId,"\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b",!isEmpty(component.parent.procedure_data["frm"]));docAddPriceOtherPanel.items.push(this.constructDocumentUploadPanel("application_docs_add_price_other", APPLIC_DOC_ADD_PRICE_OTHER,2,undefined))}if(in_array(component.parent.procedure_type,[PROCEDURE_TYPE_TENDER,PROCEDURE_TYPE_PRICELIST_REQ,PROCEDURE_TYPE_QUOTATION_REQ,PROCEDURE_TYPE_PERETORG_REDUC,PROCEDURE_TYPE_PERETORG_TENDER,PROCEDURE_TYPE_PURCHASE_WITH_GRADE]))if(in_array(component.parent.procedure_type,[PROCEDURE_TYPE_TENDER,PROCEDURE_TYPE_AUC_ASC,PROCEDURE_TYPE_AUC_DESC,PROCEDURE_TYPE_PURCHASE_WITH_GRADE])){component.parent.pricePartComponent=new Ext.Panel({name:"price",title:"\u0426\u0435\u043d\u0430 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f", frame:true,border:false,autoHeight:true,items:[{xtype:"Application.components.ApplicPriceForm",priceAllowBlank:priceAllowBlank,id:component.ids["price_panel"],vat_percent:lotData.lot.vat_percent||0,noneditablePrice:noneditablePrice||false,noneditable:component.noneditable,lot_id:lotData.lot.id,parentCmp:component.parent,application_id:component.parent.application_id,additional_items:[docPriceOtherPanel||{}],config:{price_cmp_name:"price",price_without_vat_cmp_name:"price_without_vat"}},{id:component.ids.add_price_registration_cmp, title:"\u041f\u043e\u0434\u0430\u0447\u0430 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0439",xtype:"Application.components.ApplicPriceForm",priceAllowBlank:priceAllowBlank,noneditablePrice:noneditablePrice||false,noneditable:component.noneditable,lot_id:lotData.lot.id,parentCmp:component.parent,application_id:component.parent.application_id,vat_percent:lotData.lot.vat_percent||0,additional_items:[docAddPriceOtherPanel|| {}],fixVatCheckbox:true,hidden:true,disabled:true,config:{price_cmp_name:"add_price",price_without_vat_cmp_name:"add_price_without_vat"}}]});component.parent.add(component.parent.pricePartComponent)}else{component.ids["price_panel"]=null;component.add({xtype:"Application.components.ApplicPriceForm",priceAllowBlank:priceAllowBlank,vat_percent:lotData.lot.vat_percent||0,noneditablePrice:noneditablePrice||false,noneditable:component.noneditable,lot_id:lotData.lot.id,application_id:component.parent.application_id, additional_items:[docPriceOtherPanel||{}],config:{price_cmp_name:"price",price_without_vat_cmp_name:"price_without_vat"}});component.add({id:component.ids.add_price_registration_cmp,title:"\u041f\u043e\u0434\u0430\u0447\u0430 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0439",xtype:"Application.components.ApplicPriceForm",priceAllowBlank:priceAllowBlank,noneditablePrice:noneditablePrice||false,noneditable:component.noneditable, lot_id:lotData.lot.id,application_id:component.parent.application_id,vat_percent:lotData.lot.vat_percent||0,fixVatCheckbox:true,hidden:true,disabled:true,config:{price_cmp_name:"add_price",price_without_vat_cmp_name:"add_price_without_vat"}})}component.add({xtype:"Application.components.DigitalPoaSelectFieldset",id:component.ids["digitalPoa_cmp"],editable:!component.noneditable,hidden:Main.user.eds_type!==EDS_TYPE_PERSONAL,name:"user_digitalpoa_id"});if(component.mode!="view"&&!component.noneditable&& component.parent.procedure_type!=PROCEDURE_TYPE_PRICELIST)component.add({xtype:"Application.components.ApplicationSuppliersFieldset",name:"application_suppliers",id:component.ids["suppliers_panel"]})}},applicloaded:function(applic_data){component.appl_data={};if(!applic_data.parts)applic_data.parts=[];for(var i=0;i")});component.doLayout()}else if(applic_data&&applic_data.eds_info){component.add({xtype:"fieldset",title:"\u041f\u043e\u0434\u043f\u0438\u0441\u044c",html:applic_data.eds_info_all});component.doLayout()}var contragent_info_panel_cmp=Ext.getCmp(component.ids.contragent_info_panel);if(contragent_info_panel_cmp&& contragent_info_panel_cmp.xtype=="Application.components.cmpDataViewExt"){contragent_info_panel_cmp.setValues(applic_data["supplier"]);var add_suppliers_cmp={xtype:"container",id:component.ids["suppliers_panel"],items:[]};if(applic_data.parts[1]&&!!applic_data.parts[1].enable_application_suppliers&&!!applic_data["suppliers"]&&applic_data["suppliers"].length>0&&applic_data["application_stages"]==2){Ext.each(applic_data["suppliers"],function(current_supplier){add_suppliers_cmp.items.push({xtype:"Application.components.keyValuePanel", border:false,margin:0,padding:0,style:"margin: 15px 0 0 0; padding: 0",captionCls:"no-th",fields:{full_name:"\u041f\u043e\u043b\u043d\u043e\u0435 \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438:",inn:"\u0418\u041d\u041d:",kpp:"\u041a\u041f\u041f:",legal_address:"\u042e\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u0434\u0440\u0435\u0441:",postal_address:"\u041f\u043e\u0447\u0442\u043e\u0432\u044b\u0439 \u0430\u0434\u0440\u0435\u0441:", phone:"\u041a\u043e\u043d\u0442\u0430\u043a\u0442\u043d\u044b\u0439 \u0442\u0435\u043b\u0435\u0444\u043e\u043d:"},values:current_supplier})});component.items.get(0).add(add_suppliers_cmp);component.items.get(0).setTitle("\u0417\u0430\u044f\u0432\u043a\u0430 \u043f\u043e\u0434\u0430\u0435\u0442\u0441\u044f \u0433\u0440\u0443\u043f\u043f\u043e\u0439 \u043b\u0438\u0446");component.items.get(0).doLayout()}}var add_price_registration_cmp=Ext.getCmp(component.ids.add_price_registration_cmp);if(add_price_registration_cmp&& (!isEmpty(component.appl_data.add_price)||component.parent.lot_data["status"]==Application.models.Procedure.statuses.add_price_registration)){add_price_registration_cmp.show();add_price_registration_cmp.setDisabled(false)}}}});Application.components.ApplicSecondPartEditTab.superclass.initComponent.call(this)},buildForm:function(){var items=[];var component=this;items.push(this.getPartNumberHiddenField(this.partNumber));items.push(this.getDocumentFieldset("req_docs_part_2","\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b, \u0437\u0430\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0442\u043e\u0440\u043e\u043c \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u0437\u0430\u043a\u0443\u043f\u043a\u0438 \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0437\u0430\u044f\u0432\u043a\u0438")); var docOtherPanel=this.getDocumentFieldset(this.docOtherPanelId,"\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b");docOtherPanel.items.push(this.constructDocumentUploadPanel("application_docs_other",APPLIC_DOC_OTHER,2,undefined));items.push({xtype:"fieldset",id:this.ids.small_business_first_parts_panel,name:"small_business_first_parts_panel",title:"\u041f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u043d\u043e\u0441\u0442\u044c \u043a \u043c\u0430\u043b\u043e\u043c\u0443 \u0438 \u0441\u0440\u0435\u0434\u043d\u0435\u043c\u0443 \u043f\u0440\u0435\u0434\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0443", style:"margin: 5px; padding: 5px",hidden:true,items:[]});items.push(docOtherPanel);return items},setMode:function(mode){if("updatefiles"!=mode)return;this.getComponent(0).disable()},getValues:function(){var v={};collectComponentValues(this,v,true);var priceCmp=Ext.getCmp(this.ids.price_panel);if(priceCmp&&priceCmp.isVisible())collectComponentValues(priceCmp,v,true);var addPriceCmp=Ext.getCmp(this.ids.add_price_registration_cmp);if(addPriceCmp&&addPriceCmp.isVisible()&&addPriceCmp.disabled==false)collectComponentValues(addPriceCmp, v,true);return v}});Ext.define("Application.components.CommissionForm",{extend:"Ext.form.FieldSet",members_attended:null,member_roles:null,commissionStore:null,members_attended_cmp:null,commission_id_cmp:null,initComponent:function(){var component=this;component.members_attended_cmp=Ext.id();component.commission_id_cmp=Ext.id();this.commission_members=[];component.commissionStore=new Ext.data.JsonStore({idProperty:"id",fields:["id","commission_name"]});component.addEvents("members_attended_loaded");function AddCommissionWindow(win_action){var new_commission_name= Ext.id();var new_commission_name_val="";var roles_store=new Ext.data.JsonStore({idProperty:"id",fields:["id","name"]});roles_store.loadData(component.member_roles);function displayTextLabelValue(val,params,record){for(var i=0,len=roles_store.getCount();i\u043d\u043e\u043c\u0435\u0440",id:"id",dataIndex:"id",width:30},{header:"\u0414\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043c\u044f
\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0437\u0430\u044f\u0432\u043a\u0438", dataIndex:"date",renderer:Ext.util.Format.dateRenderer("d.m.Y H:i"),width:60},{header:"\u0417\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044c",dataIndex:"supplier",width:180,renderer:function(v,m,r){return supplier_renderer(v,m,r)}},{header:"\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u0438",xtype:"textactioncolumn",actionsSeparator:"
",items:[{tooltip:"\u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0437\u0430\u044f\u0432\u043a\u0438",text:"\u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0437\u0430\u044f\u0432\u043a\u0438", newWindow:true,href:function(value,p,record){return String.format("#com/applic/view/id/{0}/lot_id/{1}",record.get("app_id"),lot.id)},isHidden:function(value,p,record){return!record.get("app_id")}},{tooltip:"\u041f\u043e\u0434\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0437\u0430\u044f\u0432\u043a\u0438",text:"\u041f\u043e\u0434\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0437\u0430\u044f\u0432\u043a\u0438", isHidden:function(value,p,record){return procedure.procedure_type===PROCEDURE_TYPE_QUOTATION_REQ||Application.models.Procedure.groups.paper_forms.indexOf(procedure.procedure_type)===0?false:true},href:function(value,p,record){return String.format("#com/procedure/requestapplic/type/request/procedure/{0}/lot/{1}/application/{2}",procedure.id,lot.id,record.get("app_id"))}}]}];var grid=new Ext.grid.GridPanel({store:store,cls:"spaced-fieldset thinborder",cm:new Ext.grid.ColumnModel({columns:dataGridColumns}), viewConfig:{forceFit:true},autoHeight:true,hideTitle:true,border:false});if(Main.config.allow_customer_add_applic)Ext.datagrid=new Ext.Panel({frame:false,border:false,name:"show_applics",layout:"form",items:[grid],buttons:[{text:Main.config.fluent_applic_enable?"\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0437\u0430\u044f\u0432\u043e\u043a \u043d\u0430 \u0443\u0447\u0430\u0441\u0442\u0438\u0435":"\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0437\u0430\u044f\u0432\u043a\u0438 \u043d\u0430 \u0443\u0447\u0430\u0441\u0442\u0438\u0435", id:applic_customer_add_id,handler:function(){redirect_to(component.module+"/applic/create/lot/"+lot.id+"/stage/"+component.stage)},scope:this}]});else Ext.datagrid=grid;Ext.apply(this,{title:this.title?this.title:"\u0412\u0441\u043a\u0440\u044b\u0442\u0438\u0435 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u043e\u0432 \u0441 \u0437\u0430\u044f\u0432\u043a\u0430\u043c\u0438 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u0432 \u043a\u043e\u043d\u043a\u0443\u0440\u0441\u0430",fileUpload:true, border:true,frame:true,width:900,items:[{id:deadline_ends_cmp,border:false,hidden:true,bodyStyle:"font-size: 12px"},{id:deadline_cmp,border:false,hidden:true,bodyStyle:"font-size: 12px"},{xtype:"fieldset",title:this.procTitle?this.procTitle:"\u041e\u0431\u0449\u0438\u0435 \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435",cls:"spaced-fieldset",defaults:{bodyStyle:"padding: 0px"},items:[{id:procedure_info_panel,hideTitle:true,border:false, cls:"x-panel-mc",items:[]}]},{xtype:"Application.components.OosProtocolPublicationFieldset",id:oos_fieldset_id,hidden:true,disabled:true,oos_type_store:oos_type_store},{xtype:"Application.components.CommissionForm",id:commission_form_id,title:"\u0421\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e \u043a\u043e\u043c\u0438\u0441\u0441\u0438\u0438",expander:null,hidden:Main.config.hide_applic_opened_commission,listeners:{render:function(){this.relayEvents(component,["applic_reviewlist_loaded"])}}}, Ext.datagrid,{xtype:"panel",border:false,cls:"spaced-panel",id:autogenerated_file_id,items:[{title:"\u041f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u0432\u0441\u043a\u0440\u044b\u0442\u0438\u044f \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u043e\u0432 \u0441 \u0437\u0430\u044f\u0432\u043a\u0430\u043c\u0438 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u0432",xtype:"fieldset",bodyStyle:"padding: 0 3px",cls:"spaced-fieldset",items:[{html:"\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u0432\u0441\u043a\u0440\u044b\u0442\u0438\u044f \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u043e\u0432 \u0441 \u0437\u0430\u044f\u0432\u043a\u0430\u043c\u0438 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u0432 \u043a\u043e\u043d\u043a\u0443\u0440\u0441\u0430 \u0434\u043b\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043d\u0430 \u043f\u043b\u043e\u0449\u0430\u0434\u043a\u0435, \u043b\u0438\u0431\u043e \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b."}], buttons:[{text:"\u0421\u043a\u0430\u0447\u0430\u0442\u044c",handler:function(){if(component.getForm().isValid())performSave(component,null,"goDownloadProtocol",false,false)}}]}]},{xtype:"hidden",name:"stage",value:component.stage},{xtype:"hidden",name:"lot_id",value:component.lot_id}],buttons:[{text:"\u041f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c \u0438 \u043d\u0430\u043f\u0440\u0430\u0432\u0438\u0442\u044c",handler:function(){if(component.getForm().isValid())performSave(component,null,"goSignProtocolPage", true,false)}}],listeners:{afterrender:function(){performRPCCall(RPC.Applic.reviewlist,[{lot_id:component.lot_id,stage:component.stage}],{wait_delay:0,wait_text:"\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u044e\u0442\u0441\u044f \u0437\u0430\u044f\u0432\u043a\u0438. \u041f\u043e\u0434\u043e\u0436\u0434\u0438\u0442\u0435..."},function(result){if(result.success){lot=result.lot;procedure=result.procedure;if(lot.date_published)procedure.date_published=lot.date_published;if(lot.date_end_registration)procedure.date_end_registration= lot.date_end_registration;if(lot.date_applic_opened)procedure.date_applic_opened=lot.date_applic_opened;Ext.getCmp(procedure_info_panel).update(component.getProcTpl(procedure));commission_selected=result.commission_selected;commission_decision=result.commission_decision;component.fireEvent("applic_reviewlist_loaded",result);var now=new Date,tmp,last_date,days;tmp=lot.date_applic_opened;last_date=parseDate(tmp);if(last_date){Ext.getCmp(deadline_ends_cmp).update('
\u041a\u0440\u0430\u0439\u043d\u0438\u0439 \u0441\u0440\u043e\u043a \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 \u0432\u0441\u043a\u0440\u044b\u0442\u0438\u044f \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u043e\u0432 \u0438\u0441\u0442\u0451\u043a '+ last_date.format("d.m.Y")+"
");Ext.getCmp(deadline_cmp).update('
\u041a\u0440\u0430\u0439\u043d\u0438\u0439 \u0441\u0440\u043e\u043a \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 \u0432\u0441\u043a\u0440\u044b\u0442\u0438\u044f \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u043e\u0432 '+last_date.format("d.m.Y")+"
");Ext.getCmp(deadline_ends_cmp).setVisible(now> last_date);Ext.getCmp(deadline_cmp).setVisible(now<=last_date)}store.loadData({applics:result.applications});if(procedure.send_to_oos){Ext.getCmp(oos_fieldset_id).enable();Ext.getCmp(oos_fieldset_id).show();if(result.oos_types)oos_type_store.loadData({rows:result.oos_types})}if(Application.models.Procedure.groups.paper_forms.indexOf(procedure.procedure_type)>=0&&!Main.config.allow_customer_add_applic){var comissionForm=Ext.getCmp(commission_form_id);if(comissionForm)comissionForm.hide();var autogeneratedFile= Ext.getCmp(autogenerated_file_id);if(autogeneratedFile)autogeneratedFile.hide();grid.hide()}component.fireEvent("reloadFilePanels");if(Application.models.Procedure.groups.paper_forms.indexOf(procedure.procedure_type)==-1){var applicCustomerAddButton=Ext.getCmp(applic_customer_add_id);if(applicCustomerAddButton)applicCustomerAddButton.hide()}}else echoResponseMessage(result)})},reloadFilePanels:function(){component.remove(Ext.getCmp(component.fileFieldsetId));component.fileFieldsetId=Ext.id();component.remove(Ext.getCmp(otherFileFieldsetId)); otherFileFieldsetId=Ext.id();loadApplicationOpeningFiles()},goDownloadProtocol:function(){var commission_id=parseInt(Ext.getCmp(commission_form_id).getCommissionValue());if(!commission_id)commission_id=-1;window.location="protocol/download/lot/"+component.lot_id+"/commission/"+commission_id+"/stage/"+component.stage},goSignProtocolPage:function(resp){var sign_url=this.module+"/protocol/signprotocol/lot/"+component.lot_id+"/stage/"+component.stage;if(component.act&&component.act=="decline")sign_url+= "/act/"+component.act;if(resp.result.success&&component.stage==2&&resp.result.showAllButton)sign_url+="/showall/1";redirect_to(sign_url)}}});Application.components.applicationsOpeningForm.superclass.initComponent.call(this);this.form.api=component.getFormApi();this.form.waitMsgTarget=true},getProcTpl:function(procedure){return getProcedureDataTemplate().apply(procedure)},getFormApi:function(){return{submit:RPC.Applic.saveReviewApplication}},addFilesPanel:function(component,proc_name){component.add({xtype:"Application.components.FilesPanel", id:component.fileFieldsetId,border:false,file_panels:[{name:"\u041f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u0432\u0441\u043a\u0440\u044b\u0442\u0438\u044f \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u043e\u0432 \u0441 \u0437\u0430\u044f\u0432\u043a\u0430\u043c\u0438 \u043d\u0430 \u0443\u0447\u0430\u0441\u0442\u0438\u0435 \u0432 "+proc_name,xtype:"fieldset",descr:'

\u0410\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u043c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0444\u0430\u0439\u043b \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430. \u0415\u0441\u043b\u0438 \u0432\u0430\u0448 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u043c\u043d\u043e\u0433\u043e\u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u0439, \u0442\u043e \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u0439\u0442\u0435 \u0441\u043a\u0430\u043d\u044b \u0432 \u0430\u0440\u0445\u0438\u0432\u0435, \u043b\u0438\u0431\u043e \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 Word.

', withDescr:false,req_id:1}]})}});Ext.define("Application.components.applicationsReviewForm",{extend:"Ext.form.Panel",module:"com",title_names:{1:"\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u0435 \u0437\u0430\u044f\u0432\u043e\u043a \u043d\u0430 \u0443\u0447\u0430\u0441\u0442\u0438\u0435",2:"\u041f\u043e\u0434\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0438\u0442\u043e\u0433\u043e\u0432 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b",3:"\u041f\u043e\u0434\u043f\u0438\u0441\u044c \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0430\u0443\u043a\u0446\u0438\u043e\u043d\u0430", 4:"\u041f\u043e\u0434\u043f\u0438\u0441\u044c \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u0442\u043e\u0440\u0436\u043a\u0438","decline":"\u041e\u0442\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u0432",6:"\u041f\u043e\u0434\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0438\u0442\u043e\u0433\u043e\u0432 \u043a\u0432\u0430\u043b\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u043e\u0442\u0431\u043e\u0440\u0430", 7:"\u041f\u043e\u0434\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0438\u0442\u043e\u0433\u043e\u0432 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u0442\u0431\u043e\u0440\u0430","supplier_info_tooltip":"\u0410\u043a\u043a\u0440\u0435\u0434\u0438\u0442\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f","supplier_info_text":"\u0410\u043a\u043a\u0440\u0435\u0434\u0438\u0442\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044f", "panel1_stage1":"\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u0447\u043b\u0435\u043d\u043e\u0432 \u043a\u043e\u043c\u0438\u0441\u0441\u0438\u0438 \u043e \u0434\u043e\u043f\u0443\u0441\u043a\u0435 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430","panel1_stage2":"\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u0447\u043b\u0435\u043d\u043e\u0432 \u043a\u043e\u043c\u0438\u0441\u0441\u0438\u0438 \u043e \u0440\u0435\u0439\u0442\u0438\u043d\u0433\u0435 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430"}, protocol_names:{1:"\u041f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044f \u0437\u0430\u044f\u0432\u043e\u043a \u043d\u0430 \u0443\u0447\u0430\u0441\u0442\u0438\u0435",2:"\u041f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u043f\u043e\u0434\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0438\u0442\u043e\u0433\u043e\u0432 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b",3:"\u041f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0430\u0443\u043a\u0446\u0438\u043e\u043d\u0430", 4:"\u041f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u0442\u043e\u0440\u0436\u043a\u0438","decline":"\u041f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u043e\u0442\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u0432",6:"\u041f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u043a\u0432\u0430\u043b\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u043e\u0442\u0431\u043e\u0440\u0430", 7:"\u041f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u0442\u0431\u043e\u0440\u0430"},downloadHref:"protocol/download",calc_coefficient_without_vat:null,initComponent:function(){var lot,procedure,commission_selected,commission_decision,component=this,order_number_assign_array=[[0,"\u041d\u0435 \u0432\u044b\u0431\u0440\u0430\u043d\u043e",false],[-1,"\u041d\u0435 \u0434\u043e\u043f\u0443\u0449\u0435\u043d", false]],otherFileFieldsetId=Ext.id(),procedure_info_panel=Ext.id(),deadline_ends_cmp=Ext.id(),deadline_cmp=Ext.id(),commission_form_id=Ext.id(),oos_fieldset_id=Ext.id(),autogenerated_file_id=Ext.id(),archive_applic_id=Ext.id(),preference925_col=Ext.id(),contract_applied_col=Ext.id(),coefficient_criteria_contract_price=Ext.id(),novat_checkbox_id=Ext.id(),indicate_application_results_combo=Ext.id(),force_finalize_check=Ext.id(),accept_procedure_failed_check=Ext.id(),accept_procedure_panel=Ext.id(); component.novat_checkbox_id=novat_checkbox_id;component.purchase_cancellation_reason_combo=Ext.id();component.downloadAutogeneratedId=Ext.id();component.fileFieldsetId=Ext.id();component.protocolsUploadId=Ext.id();component.commission_form_id=commission_form_id;component.applic_grid_id=Ext.id();component.preferences_coefficient=1;component.protocols=[];this.addEvents("reloadFilePanels");this.addEvents("goDownloadProtocol");this.addEvents("applic_reviewlist_loaded");this.addEvents("fileProtocolPanelAvailability"); this.addEvents("forceFinalizeCheckboxVisibility");this.addEvents("commission_member_check");this.addEvents("commission_selected");this.stage=Number(this.stage);var rnp_text=' '; var protocol_type=this.act=="decline"?"decline":""+this.stage;var is_autoprotocol=this.stage==3||this.stage==4;function loadApplicationReviewFiles(){component.addFilesPanel(component,protocol_type);component.doLayout();var params={wait_delay:0,wait_text:"\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u044e\u0442\u0441\u044f \u0444\u0430\u0439\u043b\u044b \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u0432. \u041f\u043e\u0434\u043e\u0436\u0434\u0438\u0442\u0435..."};performRPCCall(RPC.Protocol.getProtocolsByLot, [{lot_id:component.lot_id,stage:component.stage,tab:component.tab}],params,function(result){var params={};var oos_processed=false;params.deleteHandler=component.deleteHandler;if(result.success){if(result.protocols)for(var i=0;i'+value+"";else var text=value;if(record.get("additional_suppliers")&&record.get("additional_suppliers").length>0){var additional_suppliers_rendered=[];Ext.each(record.get("additional_suppliers"),function(item){additional_suppliers_rendered.push(render_subsupplier(item))});text+="(\u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e \u0441 "+additional_suppliers_rendered.join(", ")+")"}return text}}function render_subsupplier(data){if(!data["supplier_id"])return""; return''+data["full_name"]+""}component.members_places={};var expanded_rows=[];var expander_config={enableCaching:false,lazyRender:false,beforeExpand:function(record, rowBody,rowIndex){var isContinue=true;if(this.fireEvent("beforeexpand",this.grid,record,rowIndex)!==false){if(rowBody.innerHTML==""||!this.enableCaching)this.createExpandingRowPanel(record,rowBody,rowIndex)}else isContinue=false;return isContinue},createExpandingRowPanelItems:function(grid,store,record,rowIndex){var items=[],i;var commission_form=Ext.getCmp(commission_form_id);var commission_members=commission_form.getCommissionMembers();var panel1=component.createPanel1forExpander(component,record, commission_members,procedure);var panel2=component.createPanel2forExpander(component,record,commission_members,procedure);var panel3=component.createCriteriaPanel(component,record,commission_members);if(true){expanded_rows.push(record.get("app_id"));var n,i;for(i=0,n=commission_members.length;i\u043d\u043e\u043c\u0435\u0440",id:"id",dataIndex:"id",width:30});if([1,6,7].indexOf(component.stage)>= 0)dataGridColumns.push({header:"\u0414\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043c\u044f
\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0437\u0430\u044f\u0432\u043a\u0438",dataIndex:"date",renderer:Ext.util.Format.dateRenderer("d.m.Y H:i"),width:40});if([2,3,4].indexOf(component.stage)>=0)if(component.stage==2)dataGridColumns.push({xtype:"checkcolumn",id:preference925_col,hidden:true,header:"\u041f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442 \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e
\u043f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044e
\u041f\u0440\u0430\u0432\u0438\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430 \u2116 925", dataIndex:"preference925_applied",name:"preference925_applied",width:50});if([1,2,3,4,6,7].indexOf(component.stage)>=0)dataGridColumns.push({header:"\u0417\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044c",dataIndex:"supplier",width:50,renderer:function(v,m,r){return supplier_renderer(v,m,r)}});if([1,2,6,7].indexOf(component.stage)>=0){dataGridColumns.push({header:"\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u043e \u0434\u043e\u043f\u0443\u0441\u043a\u0435 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430", xtype:"textactioncolumn",actionsSeparator:"
",items:[{tooltip:"\u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0437\u0430\u044f\u0432\u043a\u0438",text:"\u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0437\u0430\u044f\u0432\u043a\u0438",newWindow:true,href:function(value,p,record){return String.format("#com/applic/view/id/{0}/lot_id/{1}",record.get("app_id"),lot.id)}},{tooltip:"\u041f\u043e\u0434\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0437\u0430\u044f\u0432\u043a\u0438", text:"\u041f\u043e\u0434\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0437\u0430\u044f\u0432\u043a\u0438",isHidden:function(value,p,record){if(Application.models.Procedure.groups.paper_forms.indexOf(procedure.procedure_type)>=0)return true;else return component.stage==1&&(procedure.procedure_type!=PROCEDURE_TYPE_AUC_ASC&&procedure.procedure_type!=PROCEDURE_TYPE_AUC_DESC)|| component.stage==1&&procedure.application_stages==1&&(procedure.procedure_type==PROCEDURE_TYPE_AUC_ASC||procedure.procedure_type==PROCEDURE_TYPE_AUC_DESC)||component.stage==2&&(procedure.procedure_type==PROCEDURE_TYPE_PERETORG_REDUC||procedure.procedure_type==PROCEDURE_TYPE_AUC_ASC||procedure.procedure_type==PROCEDURE_TYPE_AUC_DESC||procedure.procedure_type==PROCEDURE_TYPE_PRICELIST_REQ||procedure.procedure_type==PROCEDURE_TYPE_QUALIFICATION||!Main.config.quotation_req_enable_first_parts&&procedure.procedure_type== PROCEDURE_TYPE_QUOTATION_REQ)||component.stage==6||component.stage==7?false:true},href:function(value,p,record){return String.format("#com/procedure/requestapplic/type/request/procedure/{0}/lot/{1}/application/{2}",component.proc_id,lot.id,record.get("app_id"))}},{tooltip:component.title_names.supplier_info_tooltip,text:component.title_names.supplier_info_text,newWindow:true,isHidden:function(value,p,record){if(procedure.procedure_type==PROCEDURE_TYPE_AUC_ASC_26)return true;if(procedure.procedure_type== PROCEDURE_TYPE_AUC_DESC&&procedure.application_stages==2&&component.stage==1&&record.get("supplier_id")=="")return true;if(procedure.procedure_type==PROCEDURE_TYPE_PUBLIC_SALE)return false;return record.get("supplier_id")!=""?false:true},href:function(value,p,record){return String.format("#company/view/id/{0}/lot_id/{1}/withProcuracyFiles/{2}",record.get("supplier_id"),lot.id,2)}},{tooltip:"\u0423\u043a\u0430\u0437\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044f \u0437\u0430\u044f\u0432\u043a\u0438", text:"\u0423\u043a\u0430\u0437\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044f \u0437\u0430\u044f\u0432\u043a\u0438",handler:function(value,p,record){expander.toggleRow(datagrid.getSelectionModel().getSelectedCell()[0])}}]});if(!Application.models.Procedure.groups.paper_forms.indexOf(component.procedure_type)===0)dataGridColumns.push({header:"\u0417\u0430\u043f\u0440\u043e\u0441\u044b \u043d\u0430 \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0437\u0430\u044f\u0432\u043a\u0438", xtype:"textactioncolumn",actionsSeparator:"
",items:[{tooltip:"\u041f\u043e\u0434\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435",text:"\u041f\u043e\u0434\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435",isHidden:function(value,p,record){return component.stage==1&&(procedure.procedure_type!=PROCEDURE_TYPE_AUC_ASC&&procedure.procedure_type!= PROCEDURE_TYPE_AUC_DESC)||component.stage==1&&procedure.application_stages==1&&(procedure.procedure_type==PROCEDURE_TYPE_AUC_ASC||procedure.procedure_type==PROCEDURE_TYPE_AUC_DESC)||component.stage==2&&(procedure.procedure_type==PROCEDURE_TYPE_PERETORG_REDUC||procedure.procedure_type==PROCEDURE_TYPE_AUC_ASC||procedure.procedure_type==PROCEDURE_TYPE_AUC_DESC||procedure.procedure_type==PROCEDURE_TYPE_PRICELIST_REQ||!Main.config.quotation_req_enable_first_parts&&procedure.procedure_type==PROCEDURE_TYPE_QUOTATION_REQ)? false:true},href:function(value,p,record){return String.format("#com/procedure/requestapplic/type/request/procedure/{0}/lot/{1}/application/{2}",component.proc_id,lot.id,record.get("app_id"))}},{tooltip:"\u041f\u043e\u0434\u0430\u043d\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u0443",text:function(value,p,record){if(record.data.date_forwarded.length>0)return"\u041f\u043e\u0434\u0430\u043d\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u0443 - "+ record.data.date_forwarded.length+" ("+forDate(record)+")";return"\u041f\u043e\u0434\u0430\u043d\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u0443 - 0"},href:function(value,p,record){return String.format("#com/procedure/requestappliclist/activetab/0/procedure/{0}/supplier/{1}/application/{2}",component.proc_id,record.get("supplier_id"),record.get("app_id"))}},{tooltip:"\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043e \u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u043e\u0442 \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u0430", text:function(value,p,record){if(record.data.date_solved.length>0)return"\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043e \u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u043e\u0442 \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u0430 - "+record.data.date_solved.length+" ("+solDate(record)+")";return"\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043e \u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u043e\u0442 \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u0430 - 0"},href:function(value,p,record){return String.format("#com/procedure/requestappliclist/activetab/2/procedure/{0}/supplier/{1}/application/{2}", component.proc_id,record.get("supplier_id"),record.get("app_id"))}},{tooltip:"\u041e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u043d\u043e \u043f\u043e\u0434\u0430\u043d\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432",text:function(value,p,record){if(record.data.date_cancelled.length>0)return"\u041e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u043d\u043e \u043f\u043e\u0434\u0430\u043d\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 - "+record.data.date_cancelled.length+ " ("+canDate(record)+")";return"\u041e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u043d\u043e \u043f\u043e\u0434\u0430\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 - 0"},href:function(value,p,record){return String.format("#com/procedure/requestappliclist/activetab/3/procedure/{0}/supplier/{1}/application/{2}",component.proc_id,record.get("supplier_id"),record.get("app_id"))}}]})}function displayOrderNumberAssigned(val,params,record){var tip="";if(!Main.config.common_applic_stages)tip= val>0?" (\u041d\u0430\u0436\u043c\u0438\u0442\u0435 \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f)":" (\u041d\u0430\u0436\u043c\u0438\u0442\u0435 \u0434\u043b\u044f \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f)";if(val=="0")val="\u041d\u0435 \u0432\u044b\u0431\u0440\u0430\u043d\u043e";else if(val=="-1")val="\u041d\u0435 \u0434\u043e\u043f\u0443\u0449\u0435\u043d";return val+tip}var combo=new Application.components.combo({xtype:"Application.components.combo", editable:false,hideLabel:true,triggerAction:"all",store:orderNumberStore,disabledField:"disabled",emptyText:"\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435...",valueField:"id",displayField:"display",mode:"local",lazyRender:true,listClass:"x-combo-list-small",readOnly:Main.config.common_applic_stages,forceSelection:true,width:145,listeners:{select:function(cmp,val){var record=store.getAt(this.gridEditor.row);if(this.gridEditor)expander.expandRow(this.gridEditor.row);this.gridEditor.completeEdit(); if(val.data.id===-1){Ext.getCmp("commission_decision_no_"+record.data.id).setValue(true);record.data.accepted=-1}else if(val.data.id>0){record.data.accepted=1;Ext.getCmp("commission_decision_yes_"+record.data.id).setValue(true)}else if(val.data.id===0){Ext.getCmp("commission_decision_no_"+record.data.id).setValue(false);Ext.getCmp("commission_decision_yes_"+record.data.id).setValue(false)}}}});function rescanPlaces(oldvalue){orderNumberStore.each(function(r){r.beginEdit();r.data.disabled=false;if(r.data.id!= -1&&r.data.id&&r.data.id!=oldvalue&&-1!=store.findExact("order_number_assigned",r.data.id))r.data.disabled=true;r.endEdit()},this);orderNumberStore.fireEvent("datachanged",orderNumberStore)}if(component.stage==2){dataGridColumns.push({header:"\u041c\u0435\u0441\u0442\u043e \u0437\u0430\u044f\u0432\u043a\u0438,
\u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d\u043d\u043e\u0435 \u043a\u043e\u043c\u0438\u0441\u0441\u0438\u0435\u0439",renderer:displayOrderNumberAssigned,css:"background-color: #e5f6df;", width:60,dataIndex:"order_number_assigned",editor:combo});var comboContractApp=new Application.components.combo({xtype:"Application.components.combo",editable:false,hideLabel:true,triggerAction:"all",store:contractNumberStore,disabledField:"disabled",emptyText:"\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435...",valueField:"id",displayField:"display",mode:"local",lazyRender:true,listClass:"x-combo-list-small",readOnly:false,forceSelection:true,width:145,listeners:{select:function(cmp,val){var record= store.getAt(this.gridEditor.row);var noVal=Ext.getCmp("commission_decision_no_"+record.data.id).getValue();var yesVal=Ext.getCmp("commission_decision_yes_"+record.data.id).getValue();var basisVal=Ext.getCmp("basis_text_"+record.data.id).getValue();record.set("contract_applied",val.data.id);Ext.getCmp("commission_decision_no_"+record.data.id).setValue(noVal);Ext.getCmp("commission_decision_yes_"+record.data.id).setValue(yesVal);Ext.getCmp("basis_text_"+record.data.id).setValue(basisVal)}}});dataGridColumns.push({hidden:true, id:contract_applied_col,header:"\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435
\u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430",dataIndex:"contract_applied",name:"contract_applied",width:60,css:"background-color: #e5f6df;",renderer:function(val,params,record){var tip="";if(val==false)val="\u041d\u0435 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0442\u044c";else val="\u0417\u0430\u043a\u043b\u044e\u0447\u0438\u0442\u044c";return val+tip},editor:comboContractApp});if([2,3,4].indexOf(component.stage)>= 0){dataGridColumns.push({header:"\u041f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043e
\u0446\u0435\u043d\u0435 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430
(\u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u041d\u0414\u0421)",renderer:function(val,meta,record){if(!!record.get("preference925_applied"))val=val*component.preferences_coefficient;var result="";if(record.get("price_original")>0)result+=''+Ext.util.Format.formatPrice(record.get("price_original"))+ "
";result+=Ext.util.Format.formatPrice(val);if(record.data.price_with_vat&&record.data.price_with_vat===true)result+=" (\u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u041d\u0414\u0421)";return result},dataIndex:"price",width:40});dataGridColumns.push({header:"\u041f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043e
\u0446\u0435\u043d\u0435 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430
(\u0431\u0435\u0437 \u041d\u0414\u0421)",renderer:function(val,meta,record){var result= "";if(record.get("price_original_without_vat")>0)result+=''+Ext.util.Format.formatPrice(record.get("price_original_without_vat"))+"
";result+=Ext.util.Format.formatPrice(val);return result},dataIndex:"price_without_vat",width:40});dataGridColumns.push({header:"\u041a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442
\u0441\u043d\u0438\u0436\u0435\u043d\u0438\u044f",renderer:function(val,meta,record){var result=Ext.util.Format.number(record.data.price/ lot.start_price,"0.00");return result},hidden:true,dataIndex:"coefficient",width:40})}dataGridColumns.push({id:coefficient_criteria_contract_price,header:'\u041e\u0446\u0435\u043d\u043a\u0430 \u043f\u043e \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u044e "\u0426\u0435\u043d\u0430 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"',hidden:true,dataIndex:"coefficient_criteria_contract_price",renderer:function(val,meta,record){return parseFloat(val).toFixed(4)},name:"coefficient_criteria_contract_price", sortable:true,width:50,renderer:function(val){return Ext.util.Format.formatPrice(val,{decimalPrecision:4})}})}var datagrid=new Ext.grid.EditorGridPanel({store:store,clicksToEdit:1,id:component.applic_grid_id,cls:"spaced-fieldset thinborder",cm:new Ext.grid.ColumnModel({columns:dataGridColumns}),viewConfig:{forceFit:true,markDirty:false},autoHeight:true,plugins:expander,hideTitle:true,listeners:{beforeedit:function(e){rescanPlaces(e.value)},afteredit:function(){component.fireEvent("fileProtocolPanelAvailability"); component.fireEvent("forceFinalizeCheckboxVisibility")}}});Ext.apply(this,{title:component.title_names[protocol_type],fileUpload:true,border:true,frame:true,width:900,items:[{id:deadline_ends_cmp,border:false,hidden:true,bodyStyle:"font-size: 12px"},{id:deadline_cmp,border:false,hidden:true,bodyStyle:"font-size: 12px"},{border:false,html:'
\u0421\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0447. 4 \u0441\u0442. 12 94-\u0424\u0417 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u0435\u0434\u043e\u0441\u0442\u043e\u0432\u0435\u0440\u043d\u043e\u0441\u0442\u0438 \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u0439, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0445\u0441\u044f \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0445, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u0435\u043c \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u0447\u0430\u0441\u0442\u044f\u043c\u0438 4 \u0438 6 \u0441\u0442. 41.8 \u0417\u0430\u043a\u043e\u043d\u0430, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0444\u0430\u043a\u0442\u0430 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043b\u0438\u043a\u0432\u0438\u0434\u0430\u0446\u0438\u0438 \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044f \u044e\u0440. \u043b\u0438\u0446\u0430 \u0438\u043b\u0438 \u043f\u0440\u0438\u043d\u044f\u0442\u0438\u044f \u0430\u0440\u0431\u0438\u0442\u0440\u0430\u0436\u043d\u044b\u043c \u0441\u0443\u0434\u043e\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043e \u043f\u0440\u0438\u0437\u043d\u0430\u043d\u0438\u0438 \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044f - \u044e\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043b\u0438\u0446\u0430 \u0431\u0430\u043d\u043a\u0440\u043e\u0442\u043e\u043c \u0438 \u0442.\u0434., \u043f\u0440\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0438, \u0447\u0442\u043e \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044c \u043d\u0435 \u043e\u0431\u0436\u0430\u043b\u0443\u0435\u0442 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u0434\u043e\u043b\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u0437\u0430\u043a\u043e\u043d\u043e\u0434\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u043e\u043c \u0420\u0424, \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a, \u0423\u041e \u043e\u0431\u044f\u0437\u0430\u043d\u044b \u043e\u0442\u0441\u0442\u0440\u0430\u043d\u0438\u0442\u044c \u0442\u0430\u043a\u043e\u0433\u043e \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430 \u043e\u0442 \u0443\u0447\u0430\u0441\u0442\u0438\u044f \u0432 \u043a\u043e\u043d\u043a\u0443\u0440\u0441\u0435 \u0438\u043b\u0438 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435 \u043d\u0430 \u043b\u044e\u0431\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0438\u0445 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f. \u041d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0434\u0430\u043d\u043d\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0434\u043b\u044f \u0438\u043d\u044b\u0445 \u0446\u0435\u043b\u0435\u0439, \u0442\u0430\u043a \u043a\u0430\u043a \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u043f\u043e\u0432\u043e\u0434\u043e\u043c \u0434\u043b\u044f \u0436\u0430\u043b\u043e\u0431\u044b \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u044e\u0449\u0438\u0435 \u043e\u0440\u0433\u0430\u043d\u044b
', hidden:component.act!="decline",bodyStyle:"font-size: 12px"},{xtype:"fieldset",title:"\u041e\u0431\u0449\u0438\u0435 \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435",cls:"spaced-fieldset",defaults:{bodyStyle:"padding: 0px"},items:[{id:procedure_info_panel,hideTitle:true,border:false,cls:"x-panel-mc",items:[]}]},{xtype:"Application.components.OosProtocolPublicationFieldset",id:oos_fieldset_id,hidden:true,disabled:true,oos_type_store:oos_type_store}, {xtype:"Application.components.CommissionForm",id:component.commission_form_id,hidden:is_autoprotocol,title:"\u0421\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e \u043a\u043e\u043c\u0438\u0441\u0441\u0438\u0438",expander:expander,eventTarget:component,listeners:{render:function(){this.relayEvents(component,["applic_reviewlist_loaded"])}}},{xtype:"panel",layout:"hbox",id:novat_checkbox_id,hidden:true,layoutConfig:{padding:"5",pack:"end",align:"middle"},items:[{xtype:"checkbox",boxLabel:"\u0421\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0446\u0435\u043d\u043e\u0432\u044b\u0445 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0431\u0435\u0437 \u0443\u0447\u0435\u0442\u0430 \u041d\u0414\u0421", disabled:true,listeners:{check:function(cmp,checked){if(component.calc_coefficient_without_vat!==null){component.calc_coefficient_without_vat=checked;component.loadApplicReviewList()}else component.calc_coefficient_without_vat=checked}}}]},{xtype:"Application.components.LotExtendedApplicRegistrationPanel",hidden:!Main.config.extended_applic_registration_quotation,title:"\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u0430\u044f \u043f\u043e\u0434\u0430\u0447\u0430 \u0437\u0430\u044f\u0432\u043e\u043a", style:"margin-left: 10px; margin-right: 10px;",listeners:{render:function(){this.relayEvents(component,["applic_reviewlist_loaded"])}}},{xtype:"button",text:"\u0421\u043a\u0430\u0447\u0430\u0442\u044c \u0437\u0430\u044f\u0432\u043a\u0438 \u0432 \u0432\u0438\u0434\u0435 \u0430\u0440\u0445\u0438\u0432\u0430",style:"padding-left: 10px",id:archive_applic_id,hidden:[1,2].indexOf(component.stage)>=0&&Main.config.download_all_applics?false:true,handler:function(){var url="/Applic/getzipbylot";var params= {lot_id:component.lot_id,stage:component.stage,format:"htmljson"};var dparams={handle_failure:true,download:true,wait_disable:true};performAjaxRPCCall(url,params,dparams,echoResponseMessage)}},{xtype:"panel",padding:5,layout:"form",id:accept_procedure_panel,labelWidth:220,items:[{xtype:"checkbox",id:accept_procedure_failed_check,fieldLabel:"\u041f\u0440\u0438\u0437\u043d\u0430\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 \u043d\u0435\u0441\u043e\u0441\u0442\u043e\u044f\u0432\u0448\u0435\u0439\u0441\u044f", name:"accept_procedure_failed",listeners:{check:function(cmp,value){var indicate_application_results_combo_cmp=Ext.getCmp(indicate_application_results_combo);var purchase_cancellation_reason_combo_cmp=Ext.getCmp(component.purchase_cancellation_reason_combo);if(purchase_cancellation_reason_combo_cmp){purchase_cancellation_reason_combo_cmp.setVisible(value);purchase_cancellation_reason_combo_cmp.setDisabled(!value)}if(component.applications.length!=1){Ext.getCmp(component.applic_grid_id).setDisabled(false); indicate_application_results_combo_cmp.setVisible(false);component.fireEvent("forceFinalizeCheckboxVisibility");return true}if(!!cmp.disabled){indicate_application_results_combo_cmp.setVisible(false);Ext.getCmp(component.applic_grid_id).setDisabled(false);component.fireEvent("forceFinalizeCheckboxVisibility");return true}if(indicate_application_results_combo_cmp){indicate_application_results_combo_cmp.setVisible(value);indicate_application_results_combo_cmp.setDisabled(!value)}if(!value)Ext.getCmp(component.applic_grid_id).setDisabled(false); component.fireEvent("forceFinalizeCheckboxVisibility")}}},{id:component.purchase_cancellation_reason_combo,xtype:"combo",hidden:true,name:"purchase_cancellation_reason",mode:"local",disabled:true,allowBlank:false,fieldLabel:"\u041f\u0440\u0438\u0447\u0438\u043d\u0430 \u043d\u0435\u0441\u043e\u0441\u0442\u043e\u044f\u0432\u0448\u0435\u0439\u0441\u044f \u0437\u0430\u043a\u0443\u043f\u043a\u0438"+REQUIRED_FIELD,store:new Ext.data.ArrayStore({fields:["value","name"],data:[[null,"-"],["NO_APPLICATIONS_SUBMITTED", PURCHASE_CANCELLATION_REASON.NO_APPLICATIONS_SUBMITTED],["ALL_APPLICATIONS_CANCELED",PURCHASE_CANCELLATION_REASON.ALL_APPLICATIONS_CANCELED],["ONE_APPLICATION_SUBMITTED",PURCHASE_CANCELLATION_REASON.ONE_APPLICATION_SUBMITTED],["ALL_APPLICATIONS_CANCELED_EXCEPT_ONE",PURCHASE_CANCELLATION_REASON.ALL_APPLICATIONS_CANCELED_EXCEPT_ONE],["OTHER",PURCHASE_CANCELLATION_REASON.OTHER]]}),editable:false,valueField:"value",displayField:"name",width:350,hiddenName:"purchase_cancellation_reason",triggerAction:"all", value:null},{id:indicate_application_results_combo,xtype:"combo",hidden:true,name:"indicate_application_results",mode:"local",fieldLabel:"\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044f \u0437\u0430\u044f\u0432\u043e\u043a",store:new Ext.data.ArrayStore({fields:["value","name"],data:[[0,"\u041d\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c (\u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0432 \u0410\u0440\u0445\u0438\u0432)"], [1,"\u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c"]]}),listeners:{select:function(cmp,rec){Ext.getCmp(component.applic_grid_id).setDisabled(rec.get("value")===0);var protocolFilePanel=Ext.getCmp(component.fileFieldsetId);if(protocolFilePanel&&rec.get("value")===0)protocolFilePanel.setDisabled(false);else component.fireEvent("fileProtocolPanelAvailability")},show:function(cmp){Ext.getCmp(component.applic_grid_id).setDisabled(cmp.getValue()===0)}},editable:false,valueField:"value",displayField:"name", width:220,hiddenName:"indicate_applications_results",triggerAction:"all",value:1},{xtype:"checkbox",id:force_finalize_check,fieldLabel:"\u0417\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443",hidden:true,name:"force_finalize",inputValue:1,qtipConfig:{html:"\u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430 \u0417\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430 "+ "\u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0430 \u0432 \u0410\u0440\u0445\u0438\u0432 \u0431\u0435\u0437 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u0438 \u0434\u0435\u043d\u0435\u0436\u043d\u044b\u0435 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430 \u0440\u0430\u0437\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0442\u0441\u044f", autoHide:false,applyTipTo:"label",anchor:"left"},plugins:[Ext.ux.plugins.ToolTip]}]},datagrid,{id:autogenerated_file_id,xtype:"panel",border:false,cls:"spaced-panel",items:[{title:component.protocol_names[protocol_type],xtype:"fieldset",bodyStyle:"padding: 0 3px",cls:"spaced-fieldset",items:[{html:is_autoprotocol?"\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u0434\u043b\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043d\u0430 \u043f\u043b\u043e\u0449\u0430\u0434\u043a\u0435, \u043b\u0438\u0431\u043e \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b, \u043b\u0438\u0431\u043e \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b.": "\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0445 \u0432\u0430\u043c\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u0434\u043b\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043d\u0430 \u043f\u043b\u043e\u0449\u0430\u0434\u043a\u0435, \u043b\u0438\u0431\u043e \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b."}], buttons:[{text:"\u0421\u043a\u0430\u0447\u0430\u0442\u044c",hidden:is_autoprotocol,disabled:true,id:component.downloadAutogeneratedId,handler:function(){if(component.validateForm()){component.datagridStoreSave(component,datagrid);performSave(component,null,"goDownloadProtocol",false,false)}}}]}]},{xtype:"hidden",name:"stage",value:component.stage},{xtype:"hidden",name:"lot_id",value:component.lot_id}],buttons:[{text:"\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043a\u0430\u043a \u0447\u0435\u0440\u043d\u043e\u0432\u0438\u043a", hidden:is_autoprotocol||Main.config.common_applic_stages,handler:function(){if(component.validateForm()){if(!is_autoprotocol)component.datagridStoreSave(component,datagrid);performSave(component,null,"reloadFilePanels")}return false}},{text:"\u041f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c \u0438 \u043d\u0430\u043f\u0440\u0430\u0432\u0438\u0442\u044c",hidden:is_autoprotocol,handler:function(){if(component.validateForm())if(!is_autoprotocol)component.datagridStoreSave(component,datagrid,function(){performSave(component, null,"goSignProtocolPage",true,false,{loaded_protocols:component.protocols})});else performSave(component,null,"goSignProtocolPage",true,false,{loaded_protocols:component.protocols});else alertError("\u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u0432\u0441\u0435 \u043f\u043e\u043b\u044f \u0444\u043e\u0440\u043c\u044b")}},{text:"\u0417\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0444\u0430\u0439\u043b \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 \u043d\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439", hidden:!is_autoprotocol,handler:function(){var file=Ext.getCmp(component.fileFieldsetId);if(file.isFileAttached())performSave(component,null,"reloadFilePanels",true,false);else Ext.Msg.alert("\u041e\u0448\u0438\u0431\u043a\u0430","\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0444\u0430\u0439\u043b \u0434\u043b\u044f \u0437\u0430\u043c\u0435\u043d\u044b")}}],listeners:{beforerender:function(){component.loadApplicReviewList()},loadedApplicReviewList:function(result){lot= result.lot;procedure=result.procedure;base_procedure=result.base_procedure;oos_data=result.oos_data||{};component.procedure_type=procedure.procedure_type;component.proc_id=procedure.id;component.send_to_oos=procedure.send_to_oos;var sortInfo={field:"app_id",direction:"ASC"};if(component.stage==2&&in_array(procedure.procedure_type,[Application.models.Procedure.type_ids.contest,Application.models.Procedure.type_ids.peretorg_contest]))sortInfo={field:"coefficient_criteria_contract_price",direction:"DESC"}; else if(in_array(procedure.procedure_type,[Application.models.Procedure.type_ids.qualification,Application.models.Procedure.type_ids.pricelist,Application.models.Procedure.type_ids.auction_down,Application.models.Procedure.type_ids.auction_up,Application.models.Procedure.type_ids.purchase_with_grade]))if(!!lot["compare_application_without_vat"])sortInfo={field:"price_without_vat",direction:"ASC"};else sortInfo={field:"price",direction:"ASC"};if(RISING_PROCEDURE_TYPES.indexOf(procedure.procedure_type)> -1)sortInfo.direction="DESC";if(in_array(procedure.procedure_type,[PROCEDURE_PRICE_REQUEST,PROCEDURE_CONCURRENT_PROCEDURE,PROCEDURE_TYPE_QUALIFICATION])){sortInfo={field:"price",direction:"DESC"};if(procedure.price_increase===false)sortInfo.direction="ASC"}store.setDefaultSort(sortInfo["field"],sortInfo["direction"]);if(!isEmpty(procedure["frm"]))Ext.getCmp(component.applic_grid_id).getColumnModel().setHidden(0,true);if(in_array(procedure["procedure_type"],[PROCEDURE_TYPE_TENDER,PROCEDURE_TYPE_PRICELIST_REQ])&& lot["status"]==Application.models.Procedure.statuses.second_parts){Ext.getCmp(novat_checkbox_id).show();if(component.calc_coefficient_without_vat===null)Ext.getCmp(novat_checkbox_id).items.get(0).setValue(!!lot["compare_application_without_vat"])}if(in_array(procedure["procedure_type"],[PROCEDURE_TYPE_AUC_ASC,PROCEDURE_TYPE_AUC_DESC]))hideGridColumn(Ext.getCmp(component.applic_grid_id),"price_without_vat");if(lot.many_participants){showGridColumn(Ext.getCmp(component.applic_grid_id),"contract_applied"); showGridColumn(Ext.getCmp(component.applic_grid_id),"coefficient")}if(in_array(procedure["procedure_type"],[PROCEDURE_TYPE_QUALIFICATION])){hideGridColumn(Ext.getCmp(component.applic_grid_id),"order_number_assigned");if(!!procedure.lots&&!!procedure.lots[0]&&isEmpty(procedure.lots[0]["start_price"])){hideGridColumn(Ext.getCmp(component.applic_grid_id),"price");hideGridColumn(Ext.getCmp(component.applic_grid_id),"price_without_vat")}}if(result["preferences_coefficient"])component.preferences_coefficient= result["preferences_coefficient"];if(lot.date_published)procedure.date_published=lot.date_published;if(lot.date_end_registration)procedure.date_end_registration=lot.date_end_registration;if(lot.date_applic_opened)procedure.date_applic_opened=lot.date_applic_opened;procedure.registry_number=procedure.registry_number+", \u043b\u043e\u0442 \u2116 "+lot.number;Ext.getCmp(procedure_info_panel).update(component.getProcTpl(Ext.apply(base_procedure)));commission_selected=result.commission_selected;commission_decision= result.commission_decision;component.fireEvent("applic_reviewlist_loaded",result);var now=new Date,tmp,last_date,days;if(component.stage==1){tmp=lot.date_end_first_parts_review;if(!tmp)tmp=lot.date_begin_auction;last_date=parseDate(tmp);if(last_date){Ext.getCmp(deadline_ends_cmp).update('
\u041a\u0440\u0430\u0439\u043d\u0438\u0439 \u0441\u0440\u043e\u043a \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044f \u0437\u0430\u044f\u0432\u043e\u043a \u0438\u0441\u0442\u0451\u043a '+ last_date.format("d.m.Y")+"
");Ext.getCmp(deadline_cmp).update('
\u041a\u0440\u0430\u0439\u043d\u0438\u0439 \u0441\u0440\u043e\u043a \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044f \u0437\u0430\u044f\u0432\u043e\u043a '+last_date.format("d.m.Y")+"
");Ext.getCmp(deadline_ends_cmp).setVisible(now> last_date);Ext.getCmp(deadline_cmp).setVisible(now<=last_date)}}for(var i=0;i0]);orderNumberStore.loadData(order_number_assign_array);component.applications=result.applications;if(!isEmpty(procedure.frm))Ext.each(component.applications,function(item,i){component.applications[i].accepted=1;component.applications[i].basis_text="\u0421\u043e\u0441\u0442\u0430\u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f\u043c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438"}); store.loadData({applics:component.applications});if(procedure.send_to_oos){Ext.getCmp(oos_fieldset_id).enable();Ext.getCmp(oos_fieldset_id).show();if(result.oos_types)oos_type_store.loadData({rows:result.oos_types})}component.fireEvent("reloadFilePanels");var cm=datagrid.getColumnModel();if(component.stage==2&&(procedure.procedure_type==Application.models.Procedure.type_ids.auction_up||procedure.procedure_type==Application.models.Procedure.type_ids.auction_down))cm.setHidden(cm.getColumnCount()-1, true);if(component.stage==2&&in_array(procedure.procedure_type,[Application.models.Procedure.type_ids.contest,Application.models.Procedure.type_ids.peretorg_contest])){cm.setHidden(cm.findColumnIndex("coefficient_criteria_contract_price"),false);store.setDefaultSort("coefficient_criteria_contract_price","DESC")}if(Application.models.Procedure.type_ids.qualification==procedure.procedure_type&&component.stage!=6&&component.stage!=7)cm.setHidden(2,true);if(component.stage==2&&procedure.application_stages== 1&&(procedure.procedure_type==Application.models.Procedure.type_ids.auction_up||procedure.procedure_type==Application.models.Procedure.type_ids.auction_down))component.setTitle("\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0438\u0442\u043e\u0433\u043e\u0432");if(component.stage==1&&procedure.procedure_type!=Application.models.Procedure.type_ids.public_sale&&(procedure.procedure_type!=Application.models.Procedure.type_ids.contest||procedure.application_stages==2)){var colIndex=cm.findColumnIndex("supplier"); if(colIndex&&colIndex>0)cm.setHidden(colIndex,true)}if(Application.models.Procedure.groups.paper_forms.indexOf(procedure.procedure_type)>=0&&!Main.config.allow_customer_add_applic){var comissionForm=Ext.getCmp(commission_form_id);if(comissionForm)comissionForm.hide();var autogeneratedFile=Ext.getCmp(autogenerated_file_id);if(autogeneratedFile)autogeneratedFile.hide();var archiveApplic=Ext.getCmp(archive_applic_id);if(archiveApplic)archiveApplic.hide();datagrid.hide()}if(component.stage==2&&procedure.procedure_type== Application.models.Procedure.type_ids.public_sale){var comissionForm=Ext.getCmp(commission_form_id);if(comissionForm)comissionForm.hide();datagrid.hide()}if(!!result["preference925"]&&2==component.stage){var grid=Ext.getCmp(component.applic_grid_id);if(grid){var colIndex=cm.findColumnIndex("preference925_applied");cm.setHidden(colIndex,false)}}Ext.getCmp(accept_procedure_panel).setVisible(in_array(procedure["procedure_type"],[PROCEDURE_TYPE_AUC_DESC,PROCEDURE_TYPE_AUC_ASC,PROCEDURE_TYPE_TENDER,PROCEDURE_TYPE_PRICELIST_REQ])); if(lot.accept_procedure_failed===null&&!isEmpty(result["applications"])&&result["applications"].length<2){lot.accept_procedure_failed=true;lot.indicate_application_results=true}if(component.stage==2&&!in_array(procedure["procedure_type"],[PROCEDURE_TYPE_PRICELIST_REQ])&&!!lot.accept_procedure_failed)Ext.getCmp(accept_procedure_failed_check).setValue(true);else if(!!lot.accept_procedure_failed){Ext.getCmp(indicate_application_results_combo).setValue(lot["indicate_application_results"]?1:0);Ext.getCmp(indicate_application_results_combo).fireEvent("show", Ext.getCmp(indicate_application_results_combo));Ext.getCmp(accept_procedure_failed_check).setValue(true)}Ext.getCmp(force_finalize_check).setValue(!!lot["force_finalize"]);component.fireEvent("fileProtocolPanelAvailability");component.fireEvent("forceFinalizeCheckboxVisibility");var oos_fieldset=Ext.getCmp(oos_fieldset_id);if(!isEmpty(oos_data))oos_fieldset.setValues(oos_data)},reloadFilePanels:function(){component.remove(Ext.getCmp(component.fileFieldsetId));component.fileFieldsetId=Ext.id();component.remove(Ext.getCmp(otherFileFieldsetId)); otherFileFieldsetId=Ext.id();loadApplicationReviewFiles()},commission_selected:function(value){commission_selected=value;component.fireEvent("fileProtocolPanelAvailability")},commission_member_check:function(){component.fireEvent("fileProtocolPanelAvailability")},forceFinalizeCheckboxVisibility:function(){var is_accept_procedure_failed_check=!!Ext.getCmp(accept_procedure_failed_check).getValue();var not_accepted_counter=0;var application_count=component.applications.length||0;var form_values=component.getForm().getValues(); store.each(function(r){if(-1==r.data.order_number_assigned)not_accepted_counter++});var is_finalize_checkbox_visible=is_accept_procedure_failed_check&¬_accepted_counter+1==store.getCount();var not_accepted_checkbox_counter=0;for(var i=1;i<=application_count;i++)if(form_values["commission_decision["+i+"]"]=="0")not_accepted_checkbox_counter++;if(not_accepted_checkbox_counter+1>=application_count)is_finalize_checkbox_visible=is_accept_procedure_failed_check&&true;if(application_count<2)is_finalize_checkbox_visible= false;Ext.getCmp(force_finalize_check).setVisible(is_finalize_checkbox_visible);Ext.getCmp(force_finalize_check).setDisabled(!is_finalize_checkbox_visible)},fileProtocolPanelAvailability:function(){var show_panel=true,panel=Ext.getCmp(component.fileFieldsetId),commission=Ext.getCmp(component.commission_form_id),button=Ext.getCmp(component.downloadAutogeneratedId);store.each(function(r){if(0==r.data.order_number_assigned&&2==component.stage&&!(procedure.procedure_type==Application.models.Procedure.type_ids.auction_up|| procedure.procedure_type==Application.models.Procedure.type_ids.auction_down))show_panel=false});if(!isEmpty(procedure.frm))show_panel=true;if(panel)panel.setDisabled(false);if(button)button.setDisabled(!show_panel||!commission.isCommissionSelected(true))},goDownloadProtocol:function(){var commission_id=parseInt(Ext.getCmp(commission_form_id).getCommissionValue());if(!commission_id)commission_id=-1;window.location=component.downloadHref+"/lot/"+component.lot_id+"/commission/"+commission_id+"/stage/"+ component.stage},goSignProtocolPage:function(resp){var sign_url=this.module+"/protocol/signprotocol/lot/"+component.lot_id+"/stage/"+component.stage;if(component.act&&component.act=="decline")sign_url+="/act/"+component.act;if(resp.result.success&&component.stage==2&&resp.result.showAllButton)sign_url+="/showall/1";redirect_to(sign_url)}}});Application.components.applicationsReviewForm.superclass.initComponent.call(this);this.form.api=component.getFormApi();this.form.waitMsgTarget=true},getFormApi:function(){return{submit:RPC.Applic.saveReviewApplication}}, getProcTpl:function(procedure){return getProcedureDataTemplate().apply(procedure)},setValues:function(v){setComponentValues(this,v,true)},loadApplicReviewList:function(){var component=this;performRPCCall(RPC.Applic.reviewlist,[{lot_id:component.lot_id,stage:component.stage,calc_coefficient_without_vat:component.calc_coefficient_without_vat}],{wait_delay:0,wait_text:"\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u044e\u0442\u0441\u044f \u0437\u0430\u044f\u0432\u043a\u0438. \u041f\u043e\u0434\u043e\u0436\u0434\u0438\u0442\u0435..."}, function(result){if(result.success)component.fireEvent("loadedApplicReviewList",result);else{echoResponseMessage(result);redirect_to(component.module+"/procedure/index")}})},datagridStoreSave:function(component,datagrid,callback){var store=datagrid.getStore();store.on("save",function(){store.un("save");store.each(function(record){record.data.new_basis_text=record.data.basis_text});store.modified=[];if(Ext.isFunction(callback))callback()});store.each(function(record){record.data.basis_text=record.data.new_basis_text; record.markDirty()});if(store.getModifiedRecords().length>0)store.save();else if(Ext.isFunction(callback))callback()},addFilesPanel:function(component,protocol_type){component.add({xtype:"fieldset",title:component.protocol_names[protocol_type],id:component.fileFieldsetId,withDescr:false,descr:'

\u0410\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u043c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0444\u0430\u0439\u043b \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430. \u0415\u0441\u043b\u0438 \u0432\u0430\u0448 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u043c\u043d\u043e\u0433\u043e\u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u0439, \u0442\u043e \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u0439\u0442\u0435 \u0441\u043a\u0430\u043d\u044b \u0432 \u0430\u0440\u0445\u0438\u0432\u0435, \u043b\u0438\u0431\u043e \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 Word.

', items:[{xtype:"Application.components.multiuploadPanel",uploadHandler:RPC.Protocol.update,id:component.protocolsUploadId,deleteHandler:RPC.Protocol.deleteProtocol,name:"protocols",simultaneousUpload:false,autoUpload:true,required:false,requiredDescr:false,listeners:{beforeupload:function(cmp){cmp.uploadParams.only_file=true;cmp.uploadParams.type_id=protocol_type;cmp.uploadParams.lot_id=component.lot_id;cmp.uploadParams.req_id=1;cmp.uploadParams.requirement_id=1},uploadcomplete:function(result,action){if(result.success)component.protocols= component.protocols.concat(result.protocols)}}}]})},getTableLayoutPanel:function(col_cnt,hideBorder,hdrs){var p=new Ext.Panel({labelWidth:400,layout:"table",layoutConfig:{columns:col_cnt},bodyCssClass:undefined===hideBorder||hideBorder?"cleanborder":"displayborder",defaults:{border:false,bodyCssClass:"cleanborder"},cls:"spaced-bottom",items:[]});if(hdrs)p.add(hdrs);return p},createPanel1forExpander:function(component,record,commission_members,procedure){var comboValues=new Ext.data.ArrayStore({fields:["id", "title"],data:[["1","\u0414\u043e\u043f\u0443\u0449\u0435\u043d"],["0","\u041d\u0435 \u0434\u043e\u043f\u0443\u0449\u0435\u043d"]]});var numbers_assigned=[["-1","\u041d\u0435 \u0432\u044b\u0431\u0440\u0430\u043d\u043e",false]];if(procedure.procedure_type!=Application.models.Procedure.type_ids.contest)numbers_assigned.push([0,"\u041d\u0435 \u0434\u043e\u043f\u0443\u0449\u0435\u043d",false]);var decision_box_title=component.title_names["panel1_stage1"];if(component.stage==2){for(i=0;i\u0427\u043b\u0435\u043d \u043a\u043e\u043c\u0438\u0441\u0441\u0438\u0438"},{cellCls:"th_width_150",html:"\u0420\u043e\u043b\u044c"},{cellCls:"th_width_150",id:"decision_title"+record.get("id"),html:"\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u0447\u043b\u0435\u043d\u0430 \u043a\u043e\u043c\u0438\u0441\u0441\u0438\u0438"},{style:"padding-top: 5px",id:"reason_decision_title"+record.get("id"),hidden:procedure.procedure_type==Application.models.Procedure.type_ids.contest, html:"\u041e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0442\u043a\u0430\u0437\u0430 \u0432 \u0434\u043e\u043f\u0443\u0441\u043a\u0435 \u043a \u0443\u0447\u0430\u0441\u0442\u0438\u044e \u0432 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435"}];var member_id;if(commission_members)for(var i=0;i0)places.push(cmp.getValue())}for(i=0;i0&&v!=r.data.id&&places.indexOf(r.data.id)>=0)disable=true;if(disable!=r.data.disabled){r.beginEdit();r.data.disabled=disable;r.endEdit()}});s.fireEvent("datachanged",s)}var all_ok=true;var all_deny=true;var app_id=record.get("id");for(var j=0;j\u041e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f:"},{xtype:"textarea",width:"98%",height:50,id:"basis_text_"+record.get("id"),name:"basis_text["+record.get("id")+"]",hideLabel:true,stateful:true,stateId:"basis_text_"+component.stage+"_"+component.lot_id+"_"+record.get("app_id"),stateEvents:["blur","change"],maxLength:1E3,getState:function(){return{value:this.getValue()}}, setValue:function(value){Ext.form.TextField.superclass.setValue.apply(this,arguments);if(this.rendered&&record.data.basis_text!=value){record.data.new_basis_text=value;if(record.store.modified)record.store.modified.remove(record);record.store.modified.push(record)}},applyState:function(state){var yes=Ext.getCmp("commission_decision_yes_"+record.get("id"));if(yes&&!!state.value)this.setValue(state.value)},listeners:{blur:function(){var commission_decision_yes=Ext.getCmp("commission_decision_yes_"+ record.get("id"));var basis_text_yes="\u0421\u043e\u0441\u0442\u0430\u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f\u043c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438";if(this.getValue()!=basis_text_yes&&commission_decision_yes.checked)this.setValue(basis_text_yes)}, change:function(cmp,value){record.data.new_basis_text=value;record.data.basis_text=value;if(record.store.modified)record.store.modified.remove(record);record.store.modified.push(record)}}},{xtype:"combo",id:"reject_reason_code_"+record.get("id"),hiddenName:"reject_reason_code["+record.get("id")+"]",fieldLabel:"\u041e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f (\u0434\u043b\u044f \u0415\u0418\u0421)"+REQUIRED_FIELD,displayField:"name", valueField:"id",mode:"local",value:"OTHER",width:600,triggerAction:"all",editable:false,forceSelection:true,store:getReferenceStore("oos_rejectionReasonCode"),stateful:true,allowBlank:false,stateId:"reject_reason_code_"+component.stage+"_"+component.lot_id+"_"+record.get("app_id"),stateEvents:["blur","change"],getState:function(){return{value:this.getValue()}},applyState:function(state){this.setValue(state.value)},setVisible:function(state){if(!component.send_to_oos)state=false;return Ext.form.ComboBox.prototype.setVisible.call(this, state)},listeners:{select:function(cmp,rec){var val=rec.get("name")||"";var basis_text_cmp=Ext.getCmp("basis_text_"+record.get("id"));if(basis_text_cmp){basis_text_cmp.setValue(val);basis_text_cmp.fireEvent("blur")}}}}],listeners:{afterrender:function(){var commission_decision_no_checkbox=Ext.getCmp("commission_decision_no_"+record.get("id"));var reject_reason_checkbox=Ext.getCmp("reject_reason_code_"+record.get("id"));if(commission_decision_no_checkbox&&reject_reason_checkbox)reject_reason_checkbox.setVisible(commission_decision_no_checkbox.getValue()); if(!component.send_to_oos){reject_reason_checkbox.setVisible(false);reject_reason_checkbox.setDisabled(true)}}}});expanded=true;return panel},validateForm:function(){var novat_cmp=Ext.getCmp(this.novat_checkbox_id);if(novat_cmp&&novat_cmp.isVisible()){var purchase_cancellation_reason_combo_cmp=Ext.getCmp(this.purchase_cancellation_reason_combo);if(purchase_cancellation_reason_combo_cmp&&purchase_cancellation_reason_combo_cmp.rendered&&!purchase_cancellation_reason_combo_cmp.disabled)if(purchase_cancellation_reason_combo_cmp.getValue()=== null)return false}return this.getForm().isValid()},createCriteriaPanel:function(component,record,commission_members){}});Ext.define("Application.components.applicationsViewForm",{extend:"Ext.form.Panel",initComponent:function(){var component=this;var lot,procedure;var procedure_info_panel=Ext.id();var representative;if(component.filter=="representatives")representative=true;else representative=false;var rnp_text=' '; var store=new Ext.data.GroupingStore({autoDestroy:true,autoLoad:false,autoSave:false,groupOnSort:true,groupField:"step_pseudo",sortInfo:{field:"step_pseudo",direction:"ASC"},reader:new Ext.data.JsonReader({root:"applics",idProperty:"app_id",fields:["id","app_id","supplier_id","supplier","additional_suppliers",{name:"date",type:"date",dateFormat:"c"},{name:"date_previous",type:"date",dateFormat:"c"},"accepted","basis_text","order_number_assigned","price","status","rnp","step_full_name","step_pseudo", "has_original_application"]})});var dataGridColumns=[{header:"\u041f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0439
\u043d\u043e\u043c\u0435\u0440",id:"id",dataIndex:"id",width:30},{header:"\u0414\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043c\u044f
\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0437\u0430\u044f\u0432\u043a\u0438",dataIndex:"date",renderer:function(v,m,r){if(!isEmpty(r.get("date_previous")))return''+Ext.util.Format.date(r.get("date_previous"), "d.m.Y H:i")+"
"+Ext.util.Format.date(v,"d.m.Y H:i");return Ext.util.Format.date(v,"d.m.Y H:i")},width:40},{header:"\u0428\u0430\u0433 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b",dataIndex:"step_pseudo",width:40,hidden:true,groupRenderer:function(v,unused,r,rowIndex,colIndex,ds){switch(r.data.step_pseudo){case "correction":return"\u041f\u0440\u0438\u0435\u043c \u0437\u0430\u044f\u0432\u043e\u043a";break;case "pre_qual_registration":return"\u041f\u0440\u0438\u0435\u043c \u0437\u0430\u044f\u0432\u043e\u043a (\u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043e\u0442\u0431\u043e\u0440)"; break;default:return r.data.step_full_name;break}}},{header:"\u0421\u0442\u0430\u0442\u0443\u0441 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043f\u043e\u0434\u0430\u0447\u0438 \u0437\u0430\u044f\u0432\u043a\u0438",dataIndex:"step_full_name",width:40,hidden:true},{header:"\u0417\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044c",dataIndex:"supplier",flex:1,renderer:function(v,m,r){return supplier_renderer(v,m,r)}},{header:"\u0417\u0430\u044f\u0432\u043a\u0438", xtype:"textactioncolumn",actionsSeparator:"
",width:70,items:[{tooltip:"\u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0439 \u0437\u0430\u044f\u0432\u043a\u0438",text:"\u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0439 \u0437\u0430\u044f\u0432\u043a\u0438",isHidden:function(val,cell,r){return r.get("has_original_application")!== true},newWindow:true,href:function(value,p,record){if(component.filter=="representatives")return String.format("#com/applic/view/id/{0}/lot_id/{1}/filter/{2}/original/1",record.get("app_id"),lot.id,component.filter);else return String.format("#com/applic/view/id/{0}/lot_id/{1}/original/1",record.get("app_id"),lot.id)}},{tooltip:"\u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0437\u0430\u044f\u0432\u043a\u0438",text:"\u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0437\u0430\u044f\u0432\u043a\u0438", newWindow:true,href:function(value,p,record){if(component.filter=="representatives")return String.format("#com/applic/view/id/{0}/lot_id/{1}/filter/{2}",record.get("app_id"),lot.id,component.filter);else return String.format("#com/applic/view/id/{0}/lot_id/{1}",record.get("app_id"),lot.id)}}]},{header:"\u0421\u0442\u0430\u0442\u0443\u0441 \u0437\u0430\u044f\u0432\u043a\u0438",dataIndex:"status",width:40}];component.grid=new Ext.grid.GridPanel({store:store,clicksToEdit:1,cls:"spaced-fieldset thinborder", cm:new Ext.grid.ColumnModel({columns:dataGridColumns}),view:new Ext.grid.GroupingView({forceFit:true,autoFill:true,enableGrouping:true,emptyText:"\u041d\u0435\u0442 \u0437\u0430\u044f\u0432\u043e\u043a \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f",groupTextTpl:"{group}"}),autoHeight:true,hideTitle:true});Ext.apply(this,{title:"\u041f\u043e\u0434\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u044f\u0432\u043a\u0438",fileUpload:true,border:true,frame:true,width:900, items:[{xtype:"fieldset",title:"\u041e\u0431\u0449\u0438\u0435 \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435",cls:"spaced-fieldset",defaults:{bodyStyle:"padding: 0px"},items:[{id:procedure_info_panel,hideTitle:true,border:false,cls:"x-panel-mc",items:[]}]},component.grid],buttons:[{text:"\u0421\u043a\u0430\u0447\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u0432 (\u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 Excel)", handler:function(){var url="/Applic/viewlist";var params={lot_id:component.lot_id,viewlist_action:"download",representative:representative,format:"htmljson"};var dparams={handle_failure:true,download:true,wait_disable:true};performAjaxRPCCall(url,params,dparams,echoResponseMessage)}},{text:"\u0417\u0430\u043a\u0440\u044b\u0442\u044c",handler:function(){history.back()}}],listeners:{beforerender:function(){performRPCCall(RPC.Applic.viewlist,[{lot_id:component.lot_id,stage:component.stage,representative:representative}], {wait_delay:0,wait_text:"\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u044e\u0442\u0441\u044f \u0437\u0430\u044f\u0432\u043a\u0438. \u041f\u043e\u0434\u043e\u0436\u0434\u0438\u0442\u0435..."},function(result){if(result.success){lot=result.lot;procedure=result.procedure;component.proc_id=procedure.id;component.proc_type=procedure.procedure_type;var cm=component.grid.getColumnModel();if(component.proc_type==Application.models.Procedure.type_ids.public_sale){var index=cm.findColumnIndex("step_full_name"); cm.columns[index].hidden=true}if(lot.date_published)procedure.date_published=lot.date_published;if(lot.date_end_registration)procedure.date_end_registration=lot.date_end_registration;if(lot.date_applic_opened)procedure.date_applic_opened=lot.date_applic_opened;procedure.registry_number=procedure.registry_number+", \u043b\u043e\u0442 \u2116 "+lot.number;Ext.getCmp(procedure_info_panel).update(getProcedureDataTemplate().apply(Ext.apply(procedure)));if(Main.user.contragent_id==procedure.organizer_contragent_id|| isCustomerForProcedure(procedure)){component.applications=[];Ext.each(result.applications,function(i){if(i.status_id!=2||i.date_accepted||i.date_accepted_second_part)component.applications.push(i)})}else component.applications=result.applications;store.loadData({applics:component.applications})}else{echoResponseMessage(result);redirect_to("com/procedure/index")}})}}});Application.components.applicationsViewForm.superclass.initComponent.call(this)}});Ext.define("Application.components.contragentsVisualSelectForm",{extend:"Ext.Panel",emptyText:"\u0417\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u044b \u043d\u0435 \u0432\u0441\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u043b\u044f",exclude:[],showEmailField:true,hideButtons:false,initComponent:function(){this.error_panel_id=Ext.id();var component=this;this.getItemsTemplate=function(){var kppId=Ext.id();var titleId=Ext.id();var innId=Ext.id();var deleteButton= null;if(!component.hideButtons)deleteButton={cellCls:"width_100px",xtype:"button",text:"\u0423\u0434\u0430\u043b\u0438\u0442\u044c",hidden:component.hideButtons,iconCls:"icon-silk-delete",handler:function(b){this.remove(b.findParentByType("panel"))},scope:this};return{layout:"table",columns:4,itemPanel:true,cls:"spaced-bottom-shallow",items:[{id:innId,xtype:"combo",store:createCompanyStore("supplier",false,null,{load:function(cp,data){if(!data||!data.length)Ext.Msg.alert("\u041e\u0448\u0438\u0431\u043a\u0430", "\u041e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u0430")}}),cellCls:"width_150px",name:"application_supplier",emptyText:"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0418\u041d\u041d",mode:"remote",valueField:"id",displayField:"inn",tpl:new Ext.XTemplate('
','\u0418\u041d\u041d {inn}, \u041a\u041f\u041f {kpp} {full_name}', "
"),itemSelector:"div.search-item",width:150,allowBlank:true,minChars:3,pageSize:10,hideTrigger:true,forceSelection:true,triggerAction:"all",minListWidth:630,linked_components:{kpp:kppId,title:titleId},setValueByRecord:function(record){var cmp=Ext.getCmp(this.linked_components.kpp);if(cmp)cmp.setValue(record.data["kpp"]);var cmp=Ext.getCmp(this.linked_components.title);if(cmp)cmp.setValue(record.data["short_name"])},listeners:{select:function(combo,record,index){if(component.exclude&& component.exclude.length>0&&component.exclude.indexOf(record.get("id"))>-1){Ext.MessageBox.alert("\u041e\u0448\u0438\u0431\u043a\u0430","\u0412\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u0430\u0433\u0435\u043d\u0442\u0430",function(){combo.setValue(null);var cmp=Ext.getCmp(combo.linked_components.kpp);cmp.setValue(null);var cmp=Ext.getCmp(combo.linked_components.title);cmp.setValue(null)}); return}var cmp=Ext.getCmp(combo.linked_components.kpp);cmp.setValue(record.get("kpp"));var cmp=Ext.getCmp(combo.linked_components.title);cmp.setValue(record.get("short_name"))},afterrender:function(){if(this.value){var val=this.value;var record=this.getStore().getById(val);if(!record){var cmp=this;this.getStore().on("load",function(){var record=cmp.getStore().getById(val);if(record)cmp.setValueByRecord(record);cmp.setValue(val)},this,{single:true});this.initQuery();return false}this.setValueByRecord(record)}}}}, {id:kppId,cellCls:"width_150px",xtype:"textfield",allowBlank:true,readOnly:true,width:150},{id:titleId,cellCls:"width_400px",xtype:"textfield",allowBlank:true,readOnly:true,width:component.hideButtons?426:"90%"},deleteButton],getPanel:function(type){var p=this.find("name",type);return p&&p[0]?p[0]:null}}};if(!this.items)this.items=[];var colls=[{html:"\u0418\u041d\u041d"+REQUIRED_FIELD,cellCls:"x-inner-header width_150px"},{html:"\u041a\u041f\u041f",cellCls:"x-inner-header width_150px"},{html:"\u041d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438", cellCls:"x-inner-header width_400px"}];if(!component.hideButtons)colls.push({cellCls:"width_100px"});this.extra_items_top=this.items.length+1;this.extra_items_bottom=2;this.items.unshift({html:this.title||"\u0423\u043a\u0430\u0436\u0438\u0442\u0435 \u0441\u043f\u0438\u0441\u043e\u043a \u043a\u043e\u043d\u0442\u0440\u0430\u0433\u0435\u043d\u0442\u043e\u0432",cls:"spaced-bottom"});this.items.push({layout:"table",columns:4,cls:"spaced-bottom-shallow",items:colls},{layout:"table",columns:4,items:[{colSpan:3, items:[{hidden:true,width:"100%",id:this.error_panel_id,cls:"x-form-invalid-msg",html:""}]},{cellCls:"width_100px",xtype:"button",text:"\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c",hidden:component.hideButtons,scope:this,iconCls:"icon-silk-add",handler:function(){this.addItem()}}]});Ext.apply(this,{header:false});this.addItem();Application.components.contragentsSelectForm.superclass.initComponent.call(this)},addItem:function(v,batch){var template=this.getItemsTemplate();var i=Ext.apply({},template); i.items=[];for(var k=0;kthis.extra_items_top+this.extra_items_bottom)this.remove(this.extra_items_top+1);if(v)for(var i=0;i",{cls:"x-btn-text-icon",icon:"ico/undo.png",text:"\u041e\u0442\u043c\u0435\u043d\u0438\u0442\u044c",handler:function(){rejectStoreChanges(me.getStore())}},{cls:"x-btn-text-icon",icon:"ico/add.png",text:"\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c",handler:function(){var store=me.getStore();var record=new store.recordType({});store.insert(store.getCount(),record);me.fireEvent("rowediting",store.getCount()-1)}}]});Application.components.ContractChangeDocsGrid.superclass.initComponent.call(this)}, getValues:function(){var store=this.getStore(),jsonArr=[];store.each(function(el){jsonArr.push(el.data)});return jsonArr},setValues:function(vals){if(!isEmpty(vals))this.getStore().loadData(vals,false)}});Ext.define("Application.components.ContractCommonPanel",{extend:"Ext.panel.Panel",layout:"form",labelWidth:350,lot_final_price:null,initComponent:function(){var component=this;component.addEvents("contract_loaded","custom_purchase_plan_item_selected");this.subcontractorsTotal=Ext.id();this.subcontractorsPercent=Ext.id();component.ids=initIds(["purchase_method_combo","purchase_notice_number","lot_num","date_second_parts_review","planPurchaseItemSelectPanel","custom_purchase_plan_item_cmp"]);Ext.apply(component, {items:[{xtype:"hidden",name:"custom_purchase_plan_item",id:component.ids.custom_purchase_plan_item_cmp},{xtype:"textfield",name:"oos_registry_number",ref:"oosRegistryNumberCmp",anchor:"100%",hidden:true,fieldLabel:"\u0420\u0435\u0435\u0441\u0442\u0440\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0415\u0418\u0421"+REQUIRED_FIELD,allowBlank:false},{xtype:"textfield",name:"registration_number",anchor:"100%",fieldLabel:"\u041d\u043e\u043c\u0435\u0440 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"+ REQUIRED_FIELD,allowBlank:false},{fieldLabel:"\u0414\u0430\u0442\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"+REQUIRED_FIELD,xtype:"Application.components.dateField",format:"d.m.Y",anchor:null,allowBlank:false,name:"contract_date",width:200,plugins:[Ext.ux.plugins.ToolTip],qtipConfig:{title:"\u0414\u0430\u0442\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430", html:"

\u0415\u0441\u043b\u0438 \u0412\u044b \u043d\u0435 \u0432\u0432\u0435\u0434\u0435\u0442\u0435 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u044d\u0442\u043e \u043f\u043e\u043b\u0435, \u0432 \u0415\u0418\u0421 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u0430 \u0434\u0430\u0442\u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u043e\u043c \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0434\u043f\u0438\u0441\u044c\u044e.

", autoHide:false,applyTipTo:"label"}},{xtype:"checkbox",name:"notice_no_5_4_223",fieldLabel:"\u0418\u0437\u0432\u0435\u0449\u0435\u043d\u0438\u0435 \u043d\u0435 \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u043b\u043e\u0441\u044c \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u0447\u0430\u0441\u0442\u044c\u044e 5 \u0441\u0442\u0430\u0442\u044c\u0438 4 \u0424\u0435\u0434\u0435\u0440\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0437\u0430\u043a\u043e\u043d\u0430 \u2116223-\u0424\u0417", listeners:{check:function(cmp,checked){Ext.getCmp(component.ids.purchase_notice_number).setVisible(!checked);Ext.getCmp(component.ids.lot_num).setVisible(!checked);Ext.getCmp(component.ids.date_second_parts_review).setVisible(!checked);var reason_fieldset=Ext.getCmp(component.parent.panel_ids.reason_fieldset);if(reason_fieldset){reason_fieldset.setTitle(reason_fieldset.title.replace(REQUIRED_FIELD,""));if(!checked)reason_fieldset.setTitle(reason_fieldset.title+REQUIRED_FIELD);reason_fieldset.doLayout()}}}}, {xtype:"textfield",id:component.ids.purchase_notice_number,name:"purchase_notice_number",anchor:"100%",fieldLabel:"\u0418\u0437\u0432\u0435\u0449\u0435\u043d\u0438\u0435 \u043e \u0437\u0430\u043a\u0443\u043f\u043a\u0435"+REQUIRED_FIELD,allowBlank:false},{xtype:"textfield",id:component.ids.lot_num,name:"lot_num",anchor:"100%",fieldLabel:"\u041b\u043e\u0442"+REQUIRED_FIELD,allowBlank:false},{xtype:"Application.components.combo",id:component.ids["purchase_method_combo"],fieldLabel:"\u0421\u043f\u043e\u0441\u043e\u0431 \u0437\u0430\u043a\u0443\u043f\u043a\u0438"+ REQUIRED_FIELD,store:getPurchaseMethodStore(null),valueField:"code",displayField:"name",name:"purchase_method_code",hiddenName:"purchase_method_code",mode:"local",editable:false,customerDisabled:false,allowBlank:false,triggerAction:"all",anchor:"100%"},{xtype:"checkbox",name:"is_digital_form",fieldLabel:"\u0417\u0430\u043a\u0443\u043f\u043a\u0430 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u0435\u043d\u0430 \u0432 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u0435"}, {xtype:"checkbox",name:"is_smp",fieldLabel:"\u0423\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430\u043c\u0438 \u0437\u0430\u043a\u0443\u043f\u043a\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0443\u0431\u044a\u0435\u043a\u0442\u044b \u043c\u0430\u043b\u043e\u0433\u043e \u0438 \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u043f\u0440\u0435\u0434\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430"},{xtype:"textarea", name:"subject",anchor:"100%",fieldLabel:"\u041f\u0440\u0435\u0434\u043c\u0435\u0442 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"+REQUIRED_FIELD,allowBlank:false},{xtype:"displayfield",name:"version",anchor:"100%",fieldLabel:"\u0412\u0435\u0440\u0441\u0438\u044f \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u0439"},{name:"date_second_parts_review",width:200,xtype:"Application.components.dateField",format:"d.m.Y",id:component.ids.date_second_parts_review,fieldLabel:"\u0414\u0430\u0442\u0430 \u043f\u043e\u0434\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0438\u0442\u043e\u0433\u043e\u0432 \u0437\u0430\u043a\u0443\u043f\u043a\u0438"}, {xtype:"checkbox",name:"termination",fieldLabel:"\u0414\u043e\u0433\u043e\u0432\u043e\u0440\u043e\u043c \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043e \u043f\u0440\u0435\u043a\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432 \u0441\u0442\u043e\u0440\u043e\u043d \u043f\u043e \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0443 \u0432 \u0441\u0432\u044f\u0437\u0438 \u0441 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u0435\u043c \u0441\u0440\u043e\u043a\u0430 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"}, {xtype:"checkbox",name:"extension",fieldLabel:"\u0414\u043e\u0433\u043e\u0432\u043e\u0440\u043e\u043c \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0434\u043b\u0435\u043d\u0438\u044f \u0441\u0440\u043e\u043a\u0430 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u043f\u043e\u0441\u043b\u0435 \u0435\u0433\u043e \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f"}, {xtype:"checkbox",name:"has_subcontractor",fieldLabel:"\u041a \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044e \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043f\u0440\u0438\u0432\u043b\u0435\u0447\u0435\u043d\u044b \u0441\u0443\u0431\u043f\u043e\u0434\u0440\u044f\u0434\u0447\u0438\u043a\u0438(\u0441\u043e\u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u0438) \u0438\u0437 \u0447\u0438\u0441\u043b\u0430 \u0441\u0443\u0431\u044c\u0435\u043a\u0442\u043e\u0432 \u043c\u0430\u043b\u043e\u0433\u043e \u0438 (\u0438\u043b\u0438) \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u043f\u0440\u0435\u0434\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430", listeners:{check:function(cmp,val){var cmp=Ext.getCmp(component.subcontractorsTotal);var cmp2=Ext.getCmp(component.subcontractorsPercent);if(cmp){cmp.setVisible(!!val);cmp2.setVisible(!!val);cmp.allowBlank=!val}},afterRender:function(){this.fireEvent("check",this,this.getValue())}}},{xtype:"numberfield",id:this.subcontractorsPercent,name:"subcontractorsPercent",allowNegative:false,minValue:0,maxValue:100,allowBlank:false,fieldLabel:"\u0414\u043e\u043b\u044f \u0441\u0443\u0431\u043f\u043e\u0434\u0440\u044f\u0434\u0430, %"+ REQUIRED_FIELD,listeners:{change:function(cmp,newvalue){var totalCmp=Ext.getCmp(component.subcontractorsTotal);totalCmp.setValue(Math.round(component.lot_final_price*newvalue/100,2))}}},{xtype:"Application.components.priceField",id:this.subcontractorsTotal,name:"subcontractorsTotal",allowBlank:false,fieldLabel:"\u041e\u0431\u0449\u0430\u044f \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u043e\u0432 \u0441 \u0441\u0443\u0431\u043f\u043e\u0434\u0440\u044f\u0434\u0447\u0438\u043a\u0430\u043c\u0438"+ REQUIRED_FIELD},{xtype:"fieldset",collapsible:true,collapsed:true,title:"\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0435",items:[{xtype:"textarea",name:"additional_info",anchor:"100%",height:150,allowBlank:true,hideLabel:true}]}],listeners:{custom_purchase_plan_item_selected:function(guid){Ext.getCmp(component.ids.custom_purchase_plan_item_cmp).setValue(guid)}, contract_loaded:function(data){var cmp=Ext.getCmp(component.ids["purchase_method_combo"]);component.lot_final_price=data["lot_data"]["final_price"];if(cmp){cmp.getStore().setBaseParam("contragent_id",data["contract"]["customer_id"]);cmp.getStore().load({callback:function(){cmp.setValue(cmp.getValue())}})}if(data["oos_info"]&&data["oos_info"]["oos_registry_number"]||data["contract_data"]&&data["contract_data"]["common"]&&!isEmpty(data["contract_data"]["common"]["oos_registry_number"])){component.oosRegistryNumberCmp.show(); component.oosRegistryNumberCmp.setValue(data["oos_info"]["oos_registry_number"])}}}});Application.components.ContractCommonPanel.superclass.initComponent.call(this)}});Ext.define("Application.components.ContractContragentPanel",{extend:"Ext.panel.Panel",layout:"form",labelWidth:300,defaults:{bodyStyle:"padding: 0px",anchor:"100%"},person_hidden_fields:["kpp_id","okpo","okopf","short_name","legal_name"],not_resident_value:false,initComponent:function(){var component=this;component.ids=initIds(["legal_address_id","kpp_id","okpo","okopf","short_name","legal_name"]);Ext.apply(component,{items:[{xtype:"combo",fieldLabel:"\u041f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a", name:"supplier",ref:"supplier",triggerAction:"all",lazyRender:true,valueField:"id",displayField:"name",mode:"local",store:new Ext.data.JsonStore({fields:[{name:"id"},"name"],data:[]}),listeners:{select:function(cmp,value){setComponentValues(component,component.suppliersData[value.id])},beforeselect:function(cmp,value){component.collectContragentData()}}},{type:"hidden",name:"id"},{type:"label",fieldLabel:"\u0422\u0438\u043f"},{layout:"table",items:[{xtype:"radiogroup",columns:2,name:"type",items:[{boxLabel:"\u044e\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043b\u0438\u0446\u043e", name:"type",inputValue:"L"},{boxLabel:"\u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043b\u0438\u0446\u043e",name:"type",inputValue:"P"}],listeners:{change:function(cmp,checkedCmp){if(!cmp||!checkedCmp)return;var val=checkedCmp.getRawValue();if(val=="L")component.full_name.label.update("\u041f\u043e\u043b\u043d\u043e\u0435 \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435"+REQUIRED_FIELD);else component.full_name.label.update("\u0424\u0418\u041e"+REQUIRED_FIELD); Ext.iterate(component.person_hidden_fields,function(cmp_id){var cmp=Ext.getCmp(component.ids[cmp_id]);if(cmp){if(!cmp.hideByResident)cmp.setVisible(val=="L");cmp.hideByPerson=val!="L"}})}}}]},{xtype:"checkbox",boxLabel:"\u041f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a - \u043d\u0435\u0440\u0435\u0437\u0438\u0434\u0435\u043d\u0442 \u0420\u0424",hideLabel:true,name:"not_resident",listeners:{check:function(cmp,value){component.not_resident_value=value;var address_cmp=Ext.getCmp(component.ids["legal_address_id"]); if(!address_cmp.titles.default)address_cmp.titles.default=JSON.parse(JSON.stringify(address_cmp.titles.oos));var hide_components=[component.okopf,component.kpp,component.okpo,component.date_registered,address_cmp.oktmo_cmp,address_cmp.okato_cmp,address_cmp.region_cmp];if(value){address_cmp.hideFields.oktmo=true;address_cmp.hideFields.okato=true;address_cmp.hideFields.region=true;address_cmp.requiredFields.city=false;component.is_registered.setValue(false);component.inn.label.update("\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u043d\u0430\u043b\u043e\u0433\u043e\u043f\u043b\u0430\u0442\u0435\u043b\u044c\u0449\u0438\u043a\u0430"+ REQUIRED_FIELD+":");if(address_cmp.city_cmp){address_cmp.city_cmp.label.update("\u042d\u043b\u0435\u043c\u0435\u043d\u0442 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0441\u0442\u0440\u0430\u043d\u044b");address_cmp.city_cmp.allowBlank=true;address_cmp.settlement_cmp.label.update("\u041d\u0430\u0441\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u043f\u0443\u043d\u043a\u0442");address_cmp.titles.oos.city= "\u042d\u043b\u0435\u043c\u0435\u043d\u0442 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0441\u0442\u0440\u0430\u043d\u044b";address_cmp.titles.oos.settlement="\u041d\u0430\u0441\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u043f\u0443\u043d\u043a\u0442"}}else{address_cmp.setValues({country:"\u0420\u043e\u0441\u0441\u0438\u044f"});address_cmp.hideFields.oktmo=false;address_cmp.hideFields.okato= false;address_cmp.hideFields.region=false;address_cmp.requiredFields.city=true;component.is_registered.setValue(true);component.inn.label.update("\u0418\u041d\u041d"+REQUIRED_FIELD+":");if(address_cmp.city_cmp){address_cmp.city_cmp.label.update(address_cmp.titles.default.city+REQUIRED_FIELD);address_cmp.city_cmp.allowBlank=false;address_cmp.settlement_cmp.label.update(address_cmp.titles.default.settlement);address_cmp.titles.oos.city=address_cmp.titles.default.city;address_cmp.titles.oos.settlement= address_cmp.titles.default.settlement}}Ext.each(hide_components,function(item){if(item){if(!item.hideByPerson){item.setVisible(!value);item.setDisabled(value)}item.hideByResident=value}});address_cmp.doLayout();component.doLayout()}}},{xtype:"checkbox",boxLabel:"\u041f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a \u0441\u0443\u0431\u044a\u0435\u043a\u0442\u0430\u043c \u043c\u0430\u043b\u043e\u0433\u043e \u0438 \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u043f\u0440\u0435\u0434\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430", hideLabel:true,name:"small_biz_only"},{xtype:"checkbox",boxLabel:"\u041f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0440\u0438\u0432\u043b\u0435\u0447\u044c \u043a \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044e \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u0441\u0443\u0431\u043f\u043e\u0434\u0440\u044f\u0434\u0447\u0438\u043a\u043e\u0432 (\u0441\u043e\u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u0435\u0439) \u0438\u0437 \u0447\u0438\u0441\u043b\u0430 \u0441\u0443\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043c\u0430\u043b\u043e\u0433\u043e \u0438 \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u043f\u0440\u0435\u0434\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430", hideLabel:true,name:"requires_subcontracting"},{xtype:"checkbox",boxLabel:"\u041f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u043d\u0430 \u0443\u0447\u0435\u0442\u0435 \u0432 \u043d\u0430\u043b\u043e\u0433\u043e\u0432\u044b\u0445 \u043e\u0440\u0433\u0430\u043d\u0430\u0445 \u0420\u0424",hideLabel:true,checked:true,name:"is_registered",ref:"is_registered"},{xtype:"textfield",fieldLabel:"\u041f\u043e\u043b\u043d\u043e\u0435 \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435"+ REQUIRED_FIELD,allowBlank:true,name:"full_name",ref:"full_name"},{xtype:"textfield",fieldLabel:"\u0421\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u043d\u043e\u0435 \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435",id:component.ids["short_name"],name:"short_name"},{xtype:"textfield",fieldLabel:"\u0424\u0438\u0440\u043c\u0435\u043d\u043d\u043e\u0435 \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435",id:component.ids["legal_name"],name:"legal_name"},{xtype:"Application.components.okopfField", minChars:2,name:"okopf",ref:"okopf",anchor:"100%",fieldLabel:"\u041a\u043e\u0434 \u041e\u041a\u041e\u041f\u0424"+REQUIRED_FIELD,id:component.ids["okopf"],allowBlank:false},{xtype:"textfield",fieldLabel:"\u0418\u041d\u041d"+REQUIRED_FIELD,allowBlank:false,name:"inn",ref:"inn"},{xtype:"textfield",fieldLabel:"\u041a\u041f\u041f"+REQUIRED_FIELD,allowBlank:false,id:component.ids["kpp_id"],minLength:9,maxLength:9,name:"kpp",ref:"kpp"},{fieldLabel:"\u0414\u0430\u0442\u0430 \u043f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043d\u0430 \u0443\u0447\u0435\u0442"+ REQUIRED_FIELD,xtype:"Application.components.dateField",format:"d.m.Y",anchor:null,allowBlank:false,name:"date_registered",ref:"date_registered",width:200},{xtype:"textfield",name:"okpo",ref:"okpo",anchor:"100%",maskRe:/\d/,fieldLabel:"\u041a\u043e\u0434 \u041e\u041a\u041f\u041e"+REQUIRED_FIELD,vtype:"digits",validator:function(value){if(value&&value.length!==8&&value.length!==10)return"\u0414\u0430\u043d\u043d\u043e\u0435 \u043f\u043e\u043b\u0435 \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c 8 \u0438\u043b\u0438 10 \u0446\u0438\u0444\u0440"; return true},id:component.ids["okpo"],allowBlank:false},{xtype:"textfield",name:"email",id:"email",vtype:"email",allowBlank:false,fieldLabel:"\u0410\u0434\u0440\u0435\u0441 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0447\u0442\u044b"+REQUIRED_FIELD},{xtype:"Application.components.phonePanel",name:"phone",allowBlank:false,fieldLabel:"\u0422\u0435\u043b\u0435\u0444\u043e\u043d"+REQUIRED_FIELD},{xtype:"Application.components.FormContainer",name:"legal_address",setValues:function(vals){Ext.getCmp(component.ids["legal_address_id"]).setValues(vals)}, items:[{xtype:"fieldset",title:"\u0410\u0434\u0440\u0435\u0441 \u043c\u0435\u0441\u0442\u043e\u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f",items:[{xtype:"Application.components.addressPanel",template:"oos",arrayFields:false,useOKTMO:true,useIndexForAll:true,id:component.ids["legal_address_id"]}]}]}]});Application.components.ContractContragentPanel.superclass.initComponent.call(this)},collectContragentData:function(){if(this.suppliersData){var values={};collectComponentValues(this, values);this.suppliersData[values.supplier]=values}}});Ext.define("Application.components.ContractFilesGridPanel",{extend:"Ext.grid.GridPanel",border:false,getColumns:function(){return[{header:"\u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c",dataIndex:"is_send",width:40,xtype:"checkcolumn"},{header:"\u041d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435",dataIndex:"file_name",width:100,sortable:true},{header:"\u0422\u0438\u043f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430",dataIndex:"title",flex:1,sortable:true}]}, createStore:function(){return new Ext.data.JsonStore({autoDestroy:true,autoLoad:true,idProperty:"id",paramsAsHash:true,fields:["id","is_send","file_name","type_id","i","title"],data:[]})},initComponent:function(){var me=this;me.addEvents("contract_loaded");Ext.apply(me,{store:me.createStore(),cm:new Ext.grid.ColumnModel({columns:me.getColumns()}),viewConfig:{forceFit:true,autoFill:true,deferEmptyText:false,emptyText:"\u041d\u0435\u0442 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u043e\u0432 \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438", markDirty:false},listeners:{contract_loaded:function(contractData){var filesInfo=contractData["contract_files"]||[];me.getStore().loadData(filesInfo)}}});Application.components.ContractFilesGridPanel.superclass.initComponent.call(this)},typesRenderer:function(v,p,record){if(v==1)return"\u0414\u043e\u0433\u043e\u0432\u043e\u0440";if(v==14)return"\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435 #"+record.get("i")}, getValues:function(){var values=[];this.getStore().each(function(record){values.push({id:record.get("id"),is_send:record.get("is_send")})});return values},setValues:function(values){var me=this;if(isEmpty(values))return;Ext.iterate(values,function(record){me.getStore().getById(record.id).set("is_send",!!record.is_send)})}});Ext.define("Application.components.ContractFilesPanel",{extend:"Application.components.ContractTypedFilesPanel",discrepancyFiles:[],discrepancyFileTypeId:null,discrepancyTitle:"\u041f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u044b \u0440\u0430\u0437\u043d\u043e\u0433\u043b\u0430\u0441\u0438\u0439",needSignBySupplier:function(){return this.countActualFiles()&&!this.isSignedBySupplier()&&!this.isSignedByCustomer()},needSignByCurrentSupplier:function(){if(!this.needSignBySupplier())return false;var me= this;var needSignByCurrentSupplier=false;if(me.countFiles())Ext.iterate(me.getFiles(),function(file,i){if(!!file["is_last_version"]&&!!file["additional_suppliers_data"])Ext.iterate(file["additional_suppliers_data"],function(i,additionalSupplierData){if(Main.contragent.id===additionalSupplierData["supplier_id"]&&!additionalSupplierData["date_signed"])needSignByCurrentSupplier=true});if(!!file["is_last_version"]&&file["supplier_id"]===Main.contragent.id&&!file["date_supplier_eds"])needSignByCurrentSupplier= true});return needSignByCurrentSupplier},needSignByCustomer:function(){return this.countActualFiles()&&this.isSignedBySupplier()&&!this.isSignedByCustomer()},isSignedBySupplier:function(){var signedBySupplier=this.isSignedByContragentType("supplier");if(signedBySupplier&&this.isAdditionalSuppliers())return!this.isAwaitingAdditionalSuppliers();return signedBySupplier},isDescrepancyLocked:function(){if(this.isLastFileSigned())return true;return this.isActualSupplier()&&this.countActualDiscrepancyFiles()> 0&&!this.countActualFiles()},isDescrepancyAvailable:function(){if(this.isActualSupervisor()&&this.countVisibleFiles()>0)return true;if(this.isActualCustomer()&&this.countVisibleFiles()>0)return true;if(this.isActualSupplier()&&(this.countActualDiscrepancyFiles()>0||this.isLastDiscrepancyFileSigned()))return true;if(!this.countActualFiles()&&this.countActualDiscrepancyFiles()>0&&this.isActualCustomer())return true;if(!this.isActualSupplier()||!this.getActualFiles())return false;return this.countActualFiles()&& this.needSignBySupplier()},getDiscrepancyFiles:function(){return this.discrepancyFiles},countDiscrepancyFiles:function(){return this.getDiscrepancyFiles().length},getActualDiscrepancyFiles:function(){return this.getActualFilesByArray(this.getDiscrepancyFiles())},countActualDiscrepancyFiles:function(){return this.getActualDiscrepancyFiles().length},isLastDiscrepancyFileSigned:function(){return this.isLastFileSigned()},generateSubSuppliersSignPanel:function(files,title,only_when_everybody_signed){var me= this;var component=this;function getSupplierInfo(supplier_id){var result={};Ext.each(me.suppliers,function(supplier){if(supplier["id"]==supplier_id)result=supplier});return result}function getSubSuppliersSignPanel(data,title,contract_id){var data_json=[];Ext.iterate(data,function(i,item){item["id"]=i;data_json.push(item)});var store=new Ext.data.JsonStore({autoDestroy:true,fields:["id","supplier_full_name","status",{name:"date_signed",type:"date"}]});store.loadData(data_json);var cmp={xtype:"fieldset", title:title||"\u0421\u0442\u0430\u0442\u0443\u0441 \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044f\u043c\u0438",items:[{xtype:"grid",columns:[{header:"\u0417\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044c",flex:1,sortable:true,dataIndex:"supplier_full_name"},{header:"\u0421\u0442\u0430\u0442\u0443\u0441",width:35,renderer:function(value,metaData,record){return record.get("date_signed")?"\u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043e": "\u043e\u0436\u0438\u0434\u0430\u0435\u0442 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u044f"}},{header:"\u0414\u0430\u0442\u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u044f",width:45,dataIndex:"date_signed",renderer:Ext.util.Format.dateRenderer("d.m.Y")},{header:"\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u0438",xtype:"textactioncolumn",actionsSeparator:" ",items:[{tooltip:"\u0421\u043a\u0430\u0447\u0430\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 PKCS#7", icon:"/ico/sign.png",handler:function(grid,rowIndex,colIndex,item,e){var record=grid.getStore().getAt(rowIndex);var params={id:contract_id,supplier:record["id"]};performAjaxRPCCall("contract/getSignature",params,{download:true,wait_disable:true},echoResponseMessage)},isHidden:function(v,meta,rec){return!rec.get("date_signed")}},{tooltip:"\u0420\u0435\u043a\u0432\u0438\u0437\u0438\u0442\u044b \u043f\u043e\u0434\u043f\u0438\u0441\u0438",icon:"/ico/appl_dover.png",handler:function(grid,rowIndex,colIndex, item,e){var record=grid.getStore().getAt(rowIndex);var params={id:contract_id,supplier:record["id"]};performRPCCall(RPC.Contract.getSignatureInfo,[params],component.waitParams,function(resp){if(resp.success)Application.models.Contract.showEdsInfo(Ext.util.Format.nl2br(resp.message));else echoResponseMessage(resp)})},isHidden:function(v,meta,rec){return!rec.get("date_signed")}}],width:20,sortable:false}],autoHeight:true,store:store,viewConfig:{forceFit:true}}]};return cmp}var current_file=[];only_when_everybody_signed= only_when_everybody_signed||false;Ext.each(files,function(file){if(!!file["is_last_version"]&&!!file["actual"])current_file=file});if(!!current_file["supplierSigned"]&&!current_file["additional_suppliers_data"]){var date_eds=", "+Ext.util.Format.localDateText(parseDate(current_file["date_supplier_eds"]));var panel_text="\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u0435\u043c";return generateInfoPanel(panel_text+ date_eds+".",true,"supplier",current_file["type_id"])}if(!current_file||!current_file["additional_suppliers_data"])return{};var main_supplier=getSupplierInfo(current_file["supplier_id"]);var suppliers={0:{supplier_full_name:""+main_supplier["full_name"]+"",supplier_short_name:main_supplier["short_name"],date_signed:parseDate(current_file["date_supplier_eds"]),status:current_file["date_supplier_eds"]?1:0}};Ext.apply(suppliers,current_file["additional_suppliers_data"]);if(only_when_everybody_signed){var do_show= true;Ext.iterate(suppliers,function(i,item){if(!item["date_signed"])do_show=false});if(!do_show)return{}}return getSubSuppliersSignPanel(suppliers,title,current_file["id"])},isAdditionalSuppliers:function(){var me=this;var isAdditionalSuppliers=false;if(me.countFiles())Ext.iterate(me.getFiles(),function(file,i){if(!!file["is_last_version"]&&!!file["additional_suppliers_data"]){isAdditionalSuppliers=true;return false}});return isAdditionalSuppliers},isAwaitingAdditionalSuppliers:function(){var me= this;var isAwaitingAdditionalSuppliers=false;if(me.countFiles())Ext.iterate(me.getFiles(),function(file,i){if(!!file["is_last_version"]&&!!file["awaiting_suppliers"]){isAwaitingAdditionalSuppliers=true;return false}});return isAwaitingAdditionalSuppliers},renderAdditionalSuppliersPanels:function(){return this.generateSubSuppliersSignPanel(this.getFiles(),"\u0421\u0442\u0430\u0442\u0443\u0441 \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044f\u043c\u0438")}, renderStatusPanel:function(){var me=this;var items=[{xtype:"panel",ref:"statusPanelWrapper",items:[me.renderStatusPanelItems()]}];if(me.isAdditionalSuppliers())items.push(me.renderAdditionalSuppliersPanels());return items},renderAdditionalPanels:function(){var me=this;var items=[];if(this.isDescrepancyAvailable())items.push({xtype:"Application.components.ContractTypedFilesPanel",title:this.discrepancyTitle,files:this.discrepancyFiles,lotInfo:this.lotInfo,tabIndex:this.tabIndex,fileTypeId:this.discrepancyFileTypeId, signStrategy:["supplier"],currentCustomer:this.currentCustomer,currentSupplier:this.currentSupplier,uploadContragentType:"supplier",showInfopanel:false,locked:this.isDescrepancyLocked(),signRpcMethod:RPC.Contract.actualLastVersion,fileHashRpcMethod:RPC.Contract.loadHash,hiddenEmpty:true});return items},isAdditionalSupplier:function(){var me=this;var isAdditionalSupplier=false;if(me.countFiles())Ext.iterate(me.getFiles(),function(file,i){if(!!file["is_last_version"]&&!!file["additional_suppliers_data"])Ext.iterate(file["additional_suppliers_data"], function(i,additionalSupplierData){if(Main.contragent.id===additionalSupplierData["supplier_id"])isAdditionalSupplier=true})});return isAdditionalSupplier},isActualSupplier:function(){return Main.contragent.id==this.currentSupplier||this.isAdditionalSupplier()},isSignableContragent:function(){if(!this.countActualFiles())return false;if(this.isActualSupplier()&&this.needSignByCurrentSupplier())return true;if(this.isActualCustomer()&&this.needSignByCustomer())return true;return false},isFileDeleteEnabled:function(){return true}, getVisibleFiles:function(){if(this.isActualSupplier()||this.isActualCustomer())return this.getFiles();else return this.getVisibleFilesByArray(this.files)},isVisible:function(){var me=this;if(!me.hiddenEmpty)return true;if(!me.countActualFiles()&&!me.countActualDiscrepancyFiles()&&!me.isUploadableContragent())return false;return true},initComponent:function(){Application.components.ContractFilesPanel.superclass.initComponent.call(this)}});Ext.define("Application.components.ContractInfoPanel",{extend:"Application.components.keyValuePanel",title:"\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0435",defaults:{xtype:"panel"},getFields:function(){return{registry_number:"\u041d\u043e\u043c\u0435\u0440 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430",oos_registry_number:"\u0420\u0435\u0435\u0441\u0442\u0440\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u0415\u0418\u0421", subject:"\u041f\u0440\u0435\u0434\u043c\u0435\u0442 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430",price:"\u0426\u0435\u043d\u0430 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430",date:"\u0414\u0430\u0442\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430",contract_date:"\u0414\u0430\u0442\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430",oos_version:"\u0412\u0435\u0440\u0441\u0438\u044f \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u0439"}}, getTemplates:function(){return{price:Ext.util.Format.formatPrice,date:Ext.util.Format.localDateText}},initComponent:function(){var me=this;Ext.apply(me,{anchor:"100%",autoHeight:true,fields:me.getFields(),templates:me.getTemplates()});Application.components.ContractInfoPanel.superclass.initComponent.call(this)}});Ext.define("Application.components.ContractListPanel",{extend:"Ext.form.FormPanel",autoHeight:true,layout:"form",labelWidth:200,frame:true,defaults:{xtype:"fieldset",style:"margin: 5px 5px 0px;",bodyCssClass:"subpanel",collapsible:false,defaults:{xtype:"fieldset",collapsible:false}},monitorValid:true,signInfo:{},mode:null,mode_additional:null,types:null,lotInfo:null,lotStatus:null,lotInfoButtons:null,addAgreementButtons:null,files:{},suppliers:null,currentSupplier:null,currentCustomer:null,currentContract:null, agreementRequired:null,signatureRequired:null,participants_eds_info:null,uploadPanelId:null,win:null,notAgreedPanel:null,contractInfo:null,stagePanel:null,signDate:null,sign_window_id:null,wait_customer_requirements_text:"\u041e\u0436\u0438\u0434\u0430\u044e\u0442\u0441\u044f \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u0430 \u043a \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044e \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430.", waitParams:{mask:true,handle_failure:true,scope:this,monitor_valid:this,wait_text:"\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442\u0441\u044f \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u043e\u0432"},agreedPanel:null,button_signed_disagreement:true,button_signed_performance:true,as_mode:null,activeTab:0,initComponent:function(){var component=this;this.addEvents("reload");this.addEvents("agreed");component.govru_button_fset_id=Ext.id();component.download_all_button_id= Ext.id();component.lotInfoButtons=[];component.notAgreedPanel={xtype:"panel",buttonAlign:"center",buttons:[{text:"\u041f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c \u0434\u043e\u0433\u043e\u0432\u043e\u0440",handler:function(){component.fireEvent("agreed")}}]};component.contractInfo={xtype:"panel",collapsible:false,id:"contractInfo",style:"margin: 5px 1px 0 1px;"};component.stagePanel={xtype:"fieldset",buttonAlign:"center"};function loadContractReponse(resp){var fieldsToFill=["mode","dual_mode", "mode_additional","lotInfo","files","currentSupplier","currentSupplierInfo","currentCustomer","suppliers","customers","currentContract","agreementRequired","signatureRequired","supplierRefusedSign","participants_eds_info","currency","organizerContragent","additional_suppliers","enough_money_for_sign","contract_repudation","activeTab"];for(var i=0;i'+info_text+""}];if(component.lotInfo&&component.lotInfo.status>=7&&eds_link_type){var contract_file=null;for(var pp in component.files)if(component.files.hasOwnProperty(pp))if(component.files[pp].type_id==docs_type){contract_file=component.files[pp];component.contract_file=contract_file;break}if(contract_file&& contract_file["signatures"]&&contract_file["signatures"][eds_link_type]){var file_link=contract_file.link;if(component.currentContract.customerSigned&&eds_link_type=="customer")file_link+="/extract/1";else if(component.currentContract.supplierSigned&&eds_link_type=="supplier")file_link+="/extract/2";singed_link=''; panel_items=[{xtype:"panel",columnWidth:.6,html:'
'+info_text+singed_link+"
"},{xtype:"panel",columnWidth:.4,items:[{xtype:"button",text:"\u0420\u0435\u043a\u0432\u0438\u0437\u0438\u0442\u044b "+t("\u042d\u0426\u041f"),handler:function(){Application.models.Contract.showEdsInfo(Ext.util.Format.nl2br(contract_file["signatures"][eds_link_type]))}}]}]}}return{xtype:"fieldset",layout:"column",style:invert_margin? "margin-top: 10px; margin-bottom: 5px; padding: 5px 0;":"padding: 5px 0;",items:panel_items}}component.agreedNotNeededPanel=generateInfoPanel("\u041f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f.");component.waitCustomerRequirementsPanel=generateInfoPanel(component.wait_customer_requirements_text);function setCurrentContract(curContract){component.currentContract=curContract;if(!curContract)component.currentContract={"agreed":false, "id":null}}function showOOSPublishForm(){var winId=Ext.id();var eventWindow=new Ext.Window({closeAction:"close",width:700,height:190,layout:"fit",modal:true,resizable:false,id:winId,title:"\u041f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u043d\u0430 zakupki.gov.ru",items:[{xtype:"Application.components.ContractOOSPublishForm",winId:winId,buttonId:component.govru_button_fset_id,contract_id:component.currentContract.id,height:229,labelWidth:250}]}); eventWindow.show()}function makeText(obj){component.signDate=Ext.util.Format.localDateRenderer(new Date).replace(" ","");var supplier=component.currentSupplierInfo;var customer=Application.models.Contract.findRecordById(component.currentCustomer,component.customers);var text="\u041d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u043c \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u044c "+obj+" \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u043f\u043e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435 "+ component.lotInfo.registry_number+', \u043b\u043e\u0442 "'+component.lotInfo.title+'". '+"\u041a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u0430\u044f \u0441\u0443\u043c\u043c\u0430 \u0413\u041e\u0421\u0422 \u042034.11-94: "+component.currentContract.hash+" "+"\u0417\u0430\u043a\u0430\u0437\u0447\u0438\u043a: "+customer.full_name+" "+"\u0417\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044c: "+supplier.full_name+" "+"\u0414\u0430\u0442\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438: "+ component.signDate;return text}function makeTextRepudiation(hash){component.signDate=Ext.util.Format.localDateRenderer(new Date).replace(" ","");var supplier=component.currentSupplierInfo;var customer=Application.models.Contract.findRecordById(component.currentCustomer,component.customers);var text="\u041d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u043c \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442\u0441\u044f \u043e\u0442\u043a\u0430\u0437 \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u0430 \u043e\u0442 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u0441 \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u0435\u043c \u043f\u043e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435 "+ component.lotInfo.registry_number+', \u043b\u043e\u0442 "'+component.lotInfo.title+'". '+"\u041a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u0430\u044f \u0441\u0443\u043c\u043c\u0430 \u0413\u041e\u0421\u0422 \u042034.11-94: "+hash+" "+"\u0417\u0430\u043a\u0430\u0437\u0447\u0438\u043a: "+customer.full_name+" "+"\u0417\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044c: "+supplier.full_name+" "+"\u0414\u0430\u0442\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438: "+component.signDate; return text}function isSupplierCanSign(){if(Main.config.contracts_no_check_date)return true;var last_date_for_sign=parseDate(component.currentContract.date_agreed_end,"c");last_date_for_sign=new Date(last_date_for_sign.getFullYear(),last_date_for_sign.getMonth(),last_date_for_sign.getDate());var c_date=new Date;var cur_date=new Date(c_date.getFullYear(),c_date.getMonth(),c_date.getDate());var diff=Math.floor((cur_date.getTime()-last_date_for_sign.getTime())/(1E3*60*60*24));return diff>0?false:true} function getSupplierInfo(supplier_id){var result={};Ext.each(component.suppliers,function(supplier){if(supplier["id"]==supplier_id)result=supplier});return result}function generateSubSuppliersSignPanel(files,title,only_when_everybody_signed){var current_file=[];only_when_everybody_signed=only_when_everybody_signed||false;Ext.each(files,function(file){if(!!file["is_last_version"]&&!!file["actual"])current_file=file});if(!!current_file["supplierSigned"]&&!current_file["additional_suppliers_data"]){var date_eds= ", "+Ext.util.Format.localDateText(parseDate(current_file["date_supplier_eds"]));var panel_text="\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u0435\u043c";return generateInfoPanel(panel_text+date_eds+".",true,"supplier",current_file["type_id"])}if(!current_file||!current_file["additional_suppliers_data"])return{};var main_supplier=getSupplierInfo(current_file["supplier_id"]);var suppliers={0:{supplier_full_name:""+ main_supplier["full_name"]+"",supplier_short_name:main_supplier["short_name"],date_signed:parseDate(current_file["date_supplier_eds"]),status:current_file["date_supplier_eds"]?1:0}};Ext.apply(suppliers,current_file["additional_suppliers_data"]);if(only_when_everybody_signed){var do_show=true;Ext.iterate(suppliers,function(i,item){if(!item["date_signed"])do_show=false});if(!do_show)return{}}return getSubSuppliersSignPanel(suppliers,title,current_file["id"])}function getSubSuppliersSignPanel(data, title,contract_id){var data_json=[];Ext.iterate(data,function(i,item){item["id"]=i;data_json.push(item)});var store=new Ext.data.JsonStore({autoDestroy:true,fields:["id","supplier_full_name","status",{name:"date_signed",type:"date"}]});store.loadData(data_json);var cmp={xtype:"fieldset",title:title||"\u0421\u0442\u0430\u0442\u0443\u0441 \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044f\u043c\u0438",items:[{xtype:"grid", columns:[{header:"\u0417\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044c",flex:1,sortable:true,dataIndex:"supplier_full_name"},{header:"\u0421\u0442\u0430\u0442\u0443\u0441",width:35,renderer:function(value,metaData,record){return record.get("date_signed")?"\u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043e":"\u043e\u0436\u0438\u0434\u0430\u0435\u0442 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u044f"}},{header:"\u0414\u0430\u0442\u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u044f", width:45,dataIndex:"date_signed",renderer:Ext.util.Format.dateRenderer("d.m.Y")},{header:"\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u0438",xtype:"textactioncolumn",actionsSeparator:" ",items:[{tooltip:"\u0421\u043a\u0430\u0447\u0430\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 PKCS#7",icon:"/ico/sign.png",handler:function(grid,rowIndex,colIndex,item,e){var record=grid.getStore().getAt(rowIndex);var params={id:contract_id,supplier:record["id"]}; performAjaxRPCCall("contract/getSignature",params,{download:true,wait_disable:true},echoResponseMessage)},isHidden:function(v,meta,rec){return!rec.get("date_signed")}},{tooltip:"\u0420\u0435\u043a\u0432\u0438\u0437\u0438\u0442\u044b \u043f\u043e\u0434\u043f\u0438\u0441\u0438",icon:"/ico/appl_dover.png",handler:function(grid,rowIndex,colIndex,item,e){var record=grid.getStore().getAt(rowIndex);var params={id:contract_id,supplier:record["id"]};performRPCCall(RPC.Contract.getSignatureInfo,[params],component.waitParams, function(resp){if(resp.success)Application.models.Contract.showEdsInfo(Ext.util.Format.nl2br(resp.message));else echoResponseMessage(resp)})},isHidden:function(v,meta,rec){return!rec.get("date_signed")}}],width:20,sortable:false}],autoHeight:true,store:store,viewConfig:{forceFit:true}}]};return cmp}function getSupplierSignedPanel(){var items=[];var fieldset_title="\u0421\u0442\u0430\u0434\u0438\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u0435\u043c"; if(component.currentContract.agreed&&component.lotInfo.status==7)fieldset_title="\u0421\u0442\u0430\u0434\u0438\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u0435\u043c";else if(component.lotInfo.status==8)fieldset_title="\u0414\u043e\u0433\u043e\u0432\u043e\u0440, \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0443\u043f\u043e\u043b\u043d\u043e\u043c\u043e\u0447\u0435\u043d\u043d\u044b\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043b\u0435\u043c \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044f"; var docpanel=Ext.apply({},{bodyCssClass:"subpanel",title:fieldset_title,items:items},component.stagePanel);var empty_supplier_signed_panel=false;if(component.currentContract.supplierSigned){var date_supplier_eds="";if(component.currentContract.date_supplier_eds)date_supplier_eds=", "+Ext.util.Format.localDateText(parseDate(component.currentContract.date_supplier_eds));if(component.currentContract["additional_suppliers_data"]){var main_supplier=getSupplierInfo(component.currentContract["supplier_id"]); var suppliers={0:{supplier_full_name:""+main_supplier["full_name"]+"",supplier_short_name:main_supplier["short_name"],date_signed:parseDate(component.currentContract["date_supplier_eds"]),status:component.currentContract["date_supplier_eds"]?1:0}};Ext.apply(suppliers,component.currentContract["additional_suppliers_data"]);docpanel.items.push(getSubSuppliersSignPanel(suppliers,false,component.currentContract["id"]))}else docpanel.items.push(generateInfoPanel("\u0414\u043e\u0433\u043e\u0432\u043e\u0440 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u0435\u043c"+ date_supplier_eds+".",false,"supplier"))}else if(component.currentContract.agreed)if(!component.supplierRefusedSign&&isEmpty(component.contract_repudation))if(CONTRACT_SIGN_PAPER==component.signatureRequired)docpanel.items.push(generateInfoPanel("\u041f\u0440\u0438 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u0432 \u043f\u0438\u0441\u044c\u043c\u0435\u043d\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u0435 \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u043d\u0430 \u0431\u0443\u043c\u0430\u0433\u0435")); else if(CONTRACT_SIGN_DIGITAL==component.signatureRequired){var supplier_max_date=Ext.util.Format.localDateOnlyRenderer(parseDate(component.currentContract.date_agreed_end,"c"));docpanel.items.push(generateInfoPanel("\u041e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u0435\u043c"))}if(component.lotInfo.guarantee_needed){var filesForContractList= filterFiles(component.files,{type_id:Application.models.Contract.FILE_TYPE.supplier_guarantee});docpanel.items.push({xtype:"fieldset",title:"\u041f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u043c \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0437\u0430\u043a\u0430\u0437\u0430 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0439\u043d\u044b\u0435 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f", hidden:Ext.isEmpty(filesForContractList),items:{xtype:"ux.contractlist",files:filesForContractList,hideEds:true,hide_date_added_col:true}})}if(Application.models.Contract.filesCount(component.files,Application.models.Contract.FILE_TYPE.performance)>0){var filesFilterConfigOr={};var filesFilterConfigAnd={};filesFilterConfigAnd.type_id=Application.models.Contract.FILE_TYPE.performance;if(isCustomer())filesFilterConfigOr.date_supplier_eds="not null";var filesForContractList=filterFiles(component.files, filesFilterConfigAnd,filesFilterConfigOr);docpanel.items.push({xtype:"panel",style:"margin: 5px 0 10px 0",border:false,frame:true,title:"\u041e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430",hidden:Ext.isEmpty(filesForContractList),items:{xtype:"ux.contractlist",hideEds:true,hide_date_added_col:true,hideUpperWhileEmpty:true,files:filesForContractList}});docpanel.items.push(generateSubSuppliersSignPanel(filterFiles(component.files, {type_id:Application.models.Contract.FILE_TYPE.performance}),"\u0421\u0442\u0430\u0442\u0443\u0441 \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430",true))}if(Application.models.Contract.filesCount(component.files,Application.models.Contract.FILE_TYPE.discrepancy)>0){var filesFilterConfigOr={};var filesFilterConfigAnd={type_id:Application.models.Contract.FILE_TYPE.discrepancy, tab_index:"null"};if(isCustomer())filesFilterConfigAnd.date_supplier_eds="not null";var filesForContractList=filterFiles(component.files,filesFilterConfigAnd,filesFilterConfigOr);docpanel.items.push({xtype:"panel",style:"margin: 0 0 10px 0",border:false,frame:true,hidden:Ext.isEmpty(filesForContractList),title:"\u041f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u044b \u0440\u0430\u0437\u043d\u043e\u0433\u043b\u0430\u0441\u0438\u0439",items:{xtype:"ux.contractlist",hideEds:true,hide_date_added_col:true, files:filesForContractList}})}if(component.lotInfo.status==8&&(!component.files||component.files.length==0))docpanel.items.push(generateInfoPanel("\u041f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043d\u0435 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043b\u043e\u0441\u044c."));else if(component.lotInfo.status==7||component.lotInfo.status==8)if(component.lotInfo.contract_supplier_id==component.currentSupplier)if(Application.models.Contract.filesCount(component.files,Application.models.Contract.FILE_TYPE.draft)== 0&&2!=component.signatureRequired)docpanel.items.push(generateInfoPanel(component.wait_customer_requirements_text));else if(Application.models.Contract.filesCount(component.files,Application.models.Contract.FILE_TYPE.draft)>0&&Application.models.Contract.filesCount(component.files,Application.models.Contract.FILE_TYPE.discrepancy)==0&&empty_supplier_signed_panel==true)docpanel.items.push(generateInfoPanel("\u041e\u0436\u0438\u0434\u0430\u044e\u0442\u0441\u044f \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044f \u043a \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044e \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430.")); else docpanel.items.push(generateSubSuppliersSignPanel(filterFiles(component.files,{type_id:Application.models.Contract.FILE_TYPE.discrepancy}),"\u0421\u0442\u0430\u0442\u0443\u0441 \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u0432 \u0440\u0430\u0437\u043d\u043e\u0433\u043b\u0430\u0441\u0438\u0439"));else docpanel.items.push(generateInfoPanel("\u0414\u043e\u0433\u043e\u0432\u043e\u0440 \u0441 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u043c \u043d\u0435 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f.")); if(component.lotInfo.status==8&&docpanel.items.length==0)docpanel.hidden=true;return docpanel}function isAdditionalAgreementPanelVisible(){var visible=true;if(component.mode=="Supplier"&&isEmpty(filterFiles(component.files,{type_id:Application.models.Contract.FILE_TYPE.additional_agreement})))visible=false;visible=visible&&(!!component.currentContract["supplierSigned"]&&!!component.currentContract["customerSigned"]);var add_panel=getAdditionalAgreementPanel();return add_panel!==false?visible:false} function initDualModePanel(){var dual_mode=component["dual_mode"]||false;if(!dual_mode)return{xtype:"container"};return{xtype:"fieldset",title:"\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0444\u043e\u0440\u043c\u044b \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430",style:"padding: 0 10px;",items:[{buttonAlign:"center",buttons:[{text:"\u041a\u0430\u043a \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a", pressed:component["mode"]=="Customer",handler:function(){Application.models.Contract.redirectToContract(component.currentCustomer,component.currentSupplier,"com/contract/index/lot/"+component.lot_id+"/as/customer")}},{text:"\u041a\u0430\u043a \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a",pressed:component["mode"]=="Supplier",handler:function(){Application.models.Contract.redirectToContract(component.currentCustomer,component.currentSupplier,"com/contract/index/lot/"+component.lot_id+"/as/supplier")}}]}]}} function extractFilesByTabs(filesArray,extractedTypes){var result=[];Ext.iterate(filesArray,function(file){var tabIndex=file.tab_index;if(tabIndex==null)return true;if(extractedTypes.indexOf(file.type_id)>-1){if(result[tabIndex]==undefined)result[tabIndex]=[];if(result[tabIndex][file.type_id]==undefined)result[tabIndex][file.type_id]=[file];else result[tabIndex][file.type_id].push(file)}});return result}function extractFilesByTabIndex(filesArray,extractType,tabIndex){var result=[];Ext.iterate(filesArray, function(file){if(file.type_id==extractType&&file.tab_index==tabIndex)result.push(file)});return result}function initAdditionalPanels(){var filesByTabsAndTypes=extractFilesByTabs(component.files,[Application.models.Contract.FILE_TYPE.additional_agreement,Application.models.Contract.FILE_TYPE.supplier_other,Application.models.Contract.FILE_TYPE.customer_other,Application.models.Contract.FILE_TYPE.discrepancy]);var tabPanels=[];Ext.iterate(filesByTabsAndTypes,function(filesOnPanel,tabIndex){if(tabIndex== 0)return true;tabPanels.push(getAdditionalAgreementPanel(filesOnPanel,tabIndex))});return tabPanels}function getAdditionalAgreementPanel(filesOnPanel,tabIndex){filesOnPanel=filesOnPanel||[];var buttons=[];var isHidden=false;var isUploadable=false;var isSignable=false;var isSigned=false;var isClosable=false;var infoPanelsArray=[];var additionalAgreement_files=filesOnPanel?filesOnPanel[Application.models.Contract.FILE_TYPE.additional_agreement]||[]:[];tabIndex=tabIndex||0;if(!isEmpty(additionalAgreement_files))Ext.iterate(additionalAgreement_files, function(item){if(!item["is_last_version"])return false;if(!item["customerSigned"]&&!item["supplierSigned"]&&(component.mode=="Customer"||(component.organizerContragent==Main.contragent.id||component.currentCustomer==Main.contragent.id)))isUploadable=true;if((component.mode=="Customer"||component.mode=="View"&&component.currentCustomer==Main.contragent.id)&&!!item["supplierSigned"]&&!item["awaiting_suppliers"]&&!item["customerSigned"])isSignable=true;else if((component.mode=="Supplier"||component.mode== "View"&&component.currentSupplier==Main.contragent.id)&&!item["supplierSigned"])isSignable=true;if(!!item["supplierSigned"]||!!item["customerSigned"])isSigned=true;if(!item["supplierSigned"])if(item["mainSupplierSigned"])infoPanelsArray.push(generateSubSuppliersSignPanel(filterFiles(component.files,{type_id:Application.models.Contract.FILE_TYPE.additional_agreement,tab_index:tabIndex}),"\u0421\u0442\u0430\u0442\u0443\u0441 \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u0434\u043e\u043f. \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f")); else infoPanelsArray.push(generateInfoPanel("\u041e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044f"));else if(item["supplierSigned"]&&!item["customerSigned"])infoPanelsArray.push(generateSubSuppliersSignPanel(filterFiles(component.files,{type_id:Application.models.Contract.FILE_TYPE.additional_agreement, tab_index:tabIndex}),"\u0421\u0442\u0430\u0442\u0443\u0441 \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u0434\u043e\u043f. \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f"));else{infoPanelsArray.push(generateSubSuppliersSignPanel(filterFiles(component.files,{type_id:Application.models.Contract.FILE_TYPE.additional_agreement,tab_index:tabIndex}),"\u0421\u0442\u0430\u0442\u0443\u0441 \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u0434\u043e\u043f. \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f")); var date_eds=", "+Ext.util.Format.localDateText(parseDate(item["date_customer_eds"]));infoPanelsArray.push(generateInfoPanel("C\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043e \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u043e\u043c"+date_eds+".",true,"customer",Application.models.Contract.FILE_TYPE.additional_agreement))}});else if(component.mode=="Customer"&&!!Main.user["is_customer_admin"]){isClosable=true;isUploadable=true}else if(component.mode== "View"&&component.currentCustomer==Main.contragent.id){isClosable=false;isUploadable=true}if(isUploadable)buttons.push({text:"\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c",disabled:false,handler:function(){component.win=new Ext.Window({autoHeight:true,width:600,closeAction:"close",modal:true,title:"\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f", items:[{width:"100%",border:false,autoheight:true,frame:true,params:{"id":component.lotInfo.id,"currentCustomer":component.currentCustomer,"currentSupplier":component.currentSupplier,"type_id":Application.models.Contract.FILE_TYPE.additional_agreement,"tabIndex":tabIndex},fileUpload:true,xtype:"Application.components.uploadContractForm",componentParent:component,filePanelId:"upload-draft-form",labelWidth:150,parentWin:component,listeners:{cancelled:function(){component.win.close()},uploadComplete:function(response){component.win.close(); Main.app.run()}}}]});component.win.show()}});if(isSignable)buttons.push({text:"\u041f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c",handler:function(){if(!!Main.user.simple_signing){component.signDate=Ext.util.Format.localDateRenderer(new Date).replace(" ","");var SignText="\u041d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u043c \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u0435\u043c \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 \u0440\u0430\u0437\u043d\u043e\u0433\u043b\u0430\u0441\u0438\u0439 \u043f\u043e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435 "+ component.lotInfo.registry_number+', \u043b\u043e\u0442 "'+component.lotInfo.title+'". '+"\u0417\u0430\u043a\u0430\u0437\u0447\u0438\u043a: "+component.customers[0].full_name+". "+"\u0417\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044c: "+Main.user.full_name+". "+" \u0414\u0430\u0442\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438: "+component.signDate;var parameters={lot_id:component.lotInfo.id,"currentCustomer":component.currentCustomer,"currentSupplier":component.currentSupplier, "type_id":Application.models.Contract.FILE_TYPE.additional_agreement,"tab_index":tabIndex};var winItems=[];for(var paramName in parameters)winItems.push({xtype:"hidden",name:paramName,value:parameters[paramName]});var win=new Application.components.promptWindow({title:"\u041f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f \u043a \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0443", cmpType:"Application.components.SignatureForm",parentCmp:component,modal:true,cmpParams:{api:RPC.Contract.signAdditionalAgreement,signatureText:SignText,signatureTextHeight:250,useFormHandler:false,items:winItems,success_fn:function(resp){component.button_signed_disagreement=true;component.fireEvent("reload",component.filePanelId);win.close()}}});win.show()}else CryptoApi.setSigningCertificate(function(certificate,algoOid){loadContractHash(Application.models.Contract.FILE_TYPE.additional_agreement, algoOid,function(hash){CryptoApi.signFileByHash({hash:hash},function(signedMessage){var params={lot_id:component.lotInfo.id,currentCustomer:component.currentCustomer,currentSupplier:component.currentSupplier,type_id:Application.models.Contract.FILE_TYPE.additional_agreement,tab_index:tabIndex,signature:signedMessage,algo:algoOid};performRPCCall(RPC.Contract.signAdditionalAgreement,[params],[],function(resp){if(resp.success){component.button_signed_disagreement=true;component.fireEvent("reload",component.filePanelId)}else alertError(resp.message)})}, function(err){Ext.MessageBox.alert("\u041e\u0448\u0438\u0431\u043a\u0430","\u041e\u0448\u0438\u0431\u043a\u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u044f: "+err)})},function(message){Ext.MessageBox.alert("\u041e\u0448\u0438\u0431\u043a\u0430",message)})})}});if(!isClosable&&!isUploadable&&isEmpty(additionalAgreement_files))return false;if(isUploadable&&!tabIndex&&!!component.currentContract&&!!component.currentContract.supplierSigned&&!!component.currentContract.customerSigned&& component.lotInfo.procedure_type==PROCEDURE_TYPE_PAPER_SINGLE_SUPPLIER)isUploadable=false;var panelItems=[];panelItems.push({xtype:"Application.components.AdditionalContractFilesPanel",title:"\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435 \u043a \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0443",files:filesOnPanel[Application.models.Contract.FILE_TYPE.additional_agreement]||[],discrepancyFiles:filesOnPanel[Application.models.Contract.FILE_TYPE.discrepancy]|| [],lotInfo:component.lotInfo,tabIndex:tabIndex,fileTypeId:Application.models.Contract.FILE_TYPE.additional_agreement,discrepancyFileTypeId:Application.models.Contract.FILE_TYPE.discrepancy,signStrategy:["supplier","customer"],locked:!tabIndex&&!isUploadable,hiddenEmpty:!tabIndex&&!isUploadable,currentCustomer:component.currentCustomer,currentSupplier:component.currentSupplier,currentOrganizer:component.organizerContragent,uploadContragentType:"customer",signRpcMethod:RPC.Contract.signAdditionalAgreement, fileHashRpcMethod:RPC.Contract.loadHash,suppliers:component.suppliers,listeners:{signed:function(resp){if(!!resp.success)echoResponseMessage(resp,function(){component.changeToTab(tabIndex)});else component.changeToTab(tabIndex)}}});if(tabIndex){panelItems.push({xtype:"Application.components.ContractTypedFilesPanel",title:"\u041f\u0440\u043e\u0447\u0438\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u0430",files:filesOnPanel[Application.models.Contract.FILE_TYPE.customer_other]|| [],lotInfo:component.lotInfo,tabIndex:tabIndex,fileTypeId:Application.models.Contract.FILE_TYPE.customer_other,signStrategy:[],currentCustomer:component.currentCustomer,currentSupplier:component.currentSupplier,currentOrganizer:component.organizerContragent,uploadContragentType:"customer",hiddenEmpty:true,enableDeleteLastVersion:true,showVersions:false});panelItems.push({xtype:"Application.components.ContractTypedFilesPanel",title:"\u041f\u0440\u043e\u0447\u0438\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044f", files:filesOnPanel[Application.models.Contract.FILE_TYPE.supplier_other]||[],lotInfo:component.lotInfo,tabIndex:tabIndex,fileTypeId:Application.models.Contract.FILE_TYPE.supplier_other,signStrategy:[],currentCustomer:component.currentCustomer,currentSupplier:component.currentSupplier,currentOrganizer:component.organizerContragent,uploadContragentType:"supplier",hiddenEmpty:true,enableDeleteLastVersion:true,showVersions:false})}panelItems.push({xtype:"panel",hidden:!isClosable,buttons:[{text:"\u0417\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443", handler:function(){performRPCCall(RPC.Contract.archivate,[{lot_id:component.lot_id,contract_id:component.currentContract.id}],component.waitParams,function(resp){if(!!resp.success)redirectToArchiveIdFinalized(resp,"\u041b\u043e\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d \u0432 \u0430\u0440\u0445\u0438\u0432");else echoResponseMessage(resp)})}}],buttonAlign:"center"});var cmp={xtype:"panel",items:panelItems};return cmp}function getCustomerLoadedPanel(){var fieldset_title="\u0421\u0442\u0430\u0434\u0438\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u0441 \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u043e\u043c"; if(2==component.signatureRequired)fieldset_title="\u0421\u0442\u0430\u0434\u0438\u044f \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430";if(component.currentContract.agreed&&component.lotInfo.status==7)fieldset_title="\u0421\u0442\u0430\u0434\u0438\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u043e\u043c"; else if(component.lotInfo.status==8)fieldset_title="\u0414\u043e\u0433\u043e\u0432\u043e\u0440, \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0443\u043f\u043e\u043b\u043d\u043e\u043c\u043e\u0447\u0435\u043d\u043d\u044b\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043b\u0435\u043c \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u0430";var docpanel=Ext.apply({},{bodyCssClass:"subpanel",title:fieldset_title,items:[]},component.stagePanel);if(Application.models.Contract.filesCount(component.files, Application.models.Contract.FILE_TYPE.draft)>0){var filesForContractList=filterFiles(component.files,{type_id:Application.models.Contract.FILE_TYPE.draft});docpanel.items.push({xtype:"panel",border:false,frame:true,title:"\u0417\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0435 \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u043e\u043c "+(2==component.signatureRequired?"\u0434\u043e\u0433\u043e\u0432\u043e\u0440\u044b":"\u0434\u043e\u0433\u043e\u0432\u043e\u0440\u044b"),hidden:Ext.isEmpty(filesForContractList), items:{xtype:"ux.contractlist",hideEds:true,enableDelete:isAdmin(),enableDeleteLastVersion:isAdmin(),hide_date_added_col:true,files:filesForContractList}})}if((component.currentContract.customerSigned||component.signatureRequired==2)&&isEmpty(component.contract_repudation)){var date_customer_eds="";if(component.currentContract.date_customer_eds)date_customer_eds=", "+Ext.util.Format.localDateText(parseDate(component.currentContract.date_customer_eds));var confirm_text="\u0414\u043e\u0433\u043e\u0432\u043e\u0440 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u043e\u043c"; if(2==component.signatureRequired)confirm_text="\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u043e";docpanel.items.push(generateInfoPanel(confirm_text+date_customer_eds+".",true,"customer"));var is_oos_visible=false;if(component["currentCustomer"]==Main.contragent.id||isAdmin())is_oos_visible=true;else Ext.iterate(component["customers"],function(current_customer){if(current_customer["id"]== Main.contragent.id)is_oos_visible=true});if(component.currentContract&&component.currentContract["id"]&&(isAdmin()||isCustomerAdmin()||in_array(10,Main.user.roles))){var contractsInfo=component.currentContract.oos_contract_info||[],contractAlert={xtype:"panel",frame:false,border:false,padding:"15px 100px 10px 100px",style:"text-align:center",html:'\u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435!
\u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0435 \u043d\u0430 zakupki.gov.ru, \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0437\u0430\u043a\u0443\u043f\u043a\u0430 \u043f\u0435\u0440\u0435\u0432\u0435\u0434\u0435\u043d\u0430 \u043d\u0430 \u044d\u0442\u0430\u043f "\u0420\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e" \u0432 \u043b\u0438\u0447\u043d\u043e\u043c \u043a\u0430\u0431\u0438\u043d\u0435\u0442\u0435 \u0415\u0418\u0421'}, contractsInfoStore=new Ext.data.JsonStore({idProperty:"type",fields:["oos_contract_id","date_published","version","status","type","date_send","error_detail"]}),data=[{type:TYPE_OOS_CONTRACT},{type:TYPE_OOS_CONTRACT_EXECUTION},{type:TYPE_OOS_CONTRACT_TERMINATION}];for(var i in data){var rec=contractsInfo.filter(function(rec){return rec.type==data[i].type}).shift();if(rec)data[i]=rec}contractsInfoStore.loadData(data);var contractOosActionsGrid=new Ext.grid.GridPanel({store:contractsInfoStore,autoHeight:true, title:"\u0421\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0435, \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0435 \u043d\u0430 zakupki.gov.ru",colModel:new Ext.grid.ColumnModel({defaults:{sortable:false},columns:[{header:"\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u044f",width:200,xtype:"textactioncolumn",items:[{text:function(value,p,record){var type=record.data.type;switch(type){case TYPE_OOS_CONTRACT:return"\u041f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0432 \u0440\u0435\u0435\u0441\u0442\u0440 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u043e\u0432"; break;case TYPE_OOS_PURCHASE_CONTRACT:return"\u041f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0434\u043e\u0433\u043e\u0432\u043e\u0440 \u0432 \u0440\u0435\u0435\u0441\u0442\u0440 \u0437\u0430\u043a\u0443\u043f\u043e\u043a";break;case TYPE_OOS_SUBCONTRACTOR_INFO:return"\u041f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0435 \u0441 \u0441\u0443\u0431\u043f\u043e\u0434\u0440\u044f\u0434\u0447\u0438\u043a\u043e\u043c"; break;case TYPE_OOS_CONTRACT_EXECUTION:return"\u041f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e\u0431 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430";break;case TYPE_OOS_CONTRACT_TERMINATION:return"\u041f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e \u0440\u0430\u0441\u0442\u043e\u0440\u0436\u0435\u043d\u0438\u0438 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"; break}},handler:function(grid,rowIndex){var store=grid.getStore(),record=store.getAt(rowIndex),data=record.data,id="id/"+component.currentContract.id,type="type/"+data.type;switch(data.type){case TYPE_OOS_PURCHASE_CONTRACT:showOOSPublishForm();break;case TYPE_OOS_CONTRACT:case TYPE_OOS_SUBCONTRACTOR_INFO:case TYPE_OOS_CONTRACT_EXECUTION:case TYPE_OOS_CONTRACT_TERMINATION:redirect_to("com/contract/send/"+id+"/"+type);break}}}]},{header:"\u0414\u0430\u0442\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438", width:100,dataIndex:"date_published",sortable:true,renderer:function(v){return Ext.util.Format.localDateRenderer(v,true)}},{header:"\u0412\u0435\u0440\u0441\u0438\u044f",width:50,dataIndex:"version",sortable:true},{header:"\u0421\u0442\u0430\u0442\u0443\u0441",dataIndex:"status",sortable:true,renderer:function(val,meta,record){switch(val){case -1:return"\u041e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u043e: "+record.get("error_detail");break;case 1:if(isEmpty(record.get("date_send")))return"\u041e\u0436\u0438\u0434\u0430\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0432 \u0415\u0418\u0421..."; return"\u041e\u0436\u0438\u0434\u0430\u0435\u0442 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0432 \u0415\u0418\u0421";break;case 2:return"\u041e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d \u0432 \u0415\u0418\u0421";break}}},{xtype:"textactioncolumn",header:"",width:15,items:[{tooltip:"\u0412\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u0415\u0418\u0421",icon:"/ico/oos.png",scope:this,isHidden:function(v,m,r){return r.data.status== 0},handler:function(grid,rowIndex){var record=grid.store.getAt(rowIndex);var eventWindow=new Ext.Window({closeAction:"close",width:800,height:400,layout:"fit",modal:true,maximizable:true,title:"\u0412\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u0415\u0418\u0421 \u043f\u043e \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0443",items:[{xtype:"Application.components.OosGrid",filter_key:"oos_contract_id",filter_value:record.data.oos_contract_id,height:369}]});eventWindow.show()}}]}]}), viewConfig:{forceFit:true}});docpanel.items.push(contractAlert);docpanel.items.push(contractOosActionsGrid)}}if(component.lotInfo.status==8&&(!component.files||component.files.length==0))if(component.agreementRequired===false)docpanel.items.push(component.agreedNotNeededPanel);else docpanel.items.push(generateInfoPanel("\u041f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043d\u0435 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043b\u043e\u0441\u044c."));if(component.lotInfo.status==7&&Application.models.Contract.filesCount(component.files, Application.models.Contract.FILE_TYPE.draft)==0)if(component.currentSupplier==component.lotInfo.contract_supplier_id)if(2==component.signatureRequired)docpanel.items.push(generateInfoPanel("\u041e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0417\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u0430")); else docpanel.items.push(generateInfoPanel(component.wait_customer_requirements_text));else docpanel.items.push(generateInfoPanel("\u0414\u043e\u0433\u043e\u0432\u043e\u0440 \u0441 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u043c \u043d\u0435 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f."));if(component.lotInfo.status==8&&docpanel.items.length==0)docpanel.hidden=true;return docpanel}function getCustomerRepudiationPanel(){var button,draft_file,signed_file,i,files_count; files_count=component.files.length;for(i=0;i0){var filesForContractList=filterFiles(component.files,{type_id:Application.models.Contract.FILE_TYPE.customer_other});docpanel.items.push({xtype:"panel", border:false,frame:false,title:false,style:"margin-bottom: 10px;",items:[{xtype:"ux.contractlist",hideEds:true,hide_date_added_col:true,hide_last_version_col:true,enableDelete:!!is_current_customer,enableDeleteLastVersion:true,parentComponent:component,files:filesForContractList}]})}if(!!is_current_customer){button={text:"\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c",disabled:false,handler:function(){component.win=new Ext.Window({autoHeight:true,width:600,closeAction:"close",modal:true, title:"\u0424\u0430\u0439\u043b",items:[{width:"100%",border:false,autoheight:true,frame:true,params:{"id":component.lotInfo.id,"currentCustomer":component.currentCustomer,"currentSupplier":component.currentSupplier,"type_id":Application.models.Contract.FILE_TYPE.customer_other},fileUpload:true,xtype:"Application.components.uploadContractForm",componentParent:component,filePanelId:"upload-draft-form",labelWidth:150,parentWin:component,listeners:{cancelled:function(){component.win.close()},uploadComplete:function(response){component.win.close(); Main.app.run()}}}]});component.win.show()}};docpanel.buttons.push(button)}return docpanel}function getSupplierOthersPanel(){var button,other_files_count=Application.models.Contract.filesCount(component.files,Application.models.Contract.FILE_TYPE.supplier_other),is_current_supplier=component.currentSupplier==Main.user.contragent_id&&component.lotInfo.contract_supplier_id==Main.user.contragent_id;if(!component.currentContract.agreed);if(!is_current_supplier&&!other_files_count)return null;if(component.lotInfo.status== 8&&!other_files_count)return null;var filesForContractList=filterFiles(component.files,{type_id:Application.models.Contract.FILE_TYPE.supplier_other});return{xtype:"Application.components.ContractTypedFilesPanel",title:"\u041f\u0440\u043e\u0447\u0438\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044f",files:filesForContractList,lotInfo:component.lotInfo,tabIndex:null,fileTypeId:Application.models.Contract.FILE_TYPE.supplier_other,signStrategy:[], currentCustomer:component.currentCustomer,currentSupplier:component.currentSupplier,currentOrganizer:component.organizerContragent,uploadContragentType:"supplier",hiddenEmpty:true,enableDeleteLastVersion:true,showVersions:false};var docpanel=Ext.apply({},{bodyCssClass:"subpanel",title:"\u041f\u0440\u043e\u0447\u0438\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044f",html:is_current_supplier&&other_files_count<1?'
\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u0442\u044c \u0437\u0434\u0435\u0441\u044c \u043b\u044e\u0431\u044b\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b, \u0437\u0430\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u043e\u043c \u0434\u043b\u044f \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430
': null,items:[],buttons:[]},component.stagePanel);if(other_files_count>0){var filesForContractList=filterFiles(component.files,{type_id:Application.models.Contract.FILE_TYPE.supplier_other});docpanel.items.push({xtype:"panel",border:false,frame:false,title:false,style:"margin-bottom: 10px;",items:[{xtype:"ux.contractlist",hideEds:true,hide_date_added_col:true,hide_last_version_col:true,enableDelete:!!is_current_supplier&&!isCurrentContractCosigned(component.files),enableDeleteLastVersion:true,parentComponent:component, files:filesForContractList}]})}if(!!is_current_supplier){button={text:"\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c",disabled:false,handler:function(){component.win=new Ext.Window({autoHeight:true,width:600,closeAction:"close",modal:true,title:"\u0424\u0430\u0439\u043b",items:[{width:"100%",border:false,autoheight:true,frame:true,params:{"id":component.lotInfo.id,"currentCustomer":component.currentCustomer,"currentSupplier":component.currentSupplier,"type_id":Application.models.Contract.FILE_TYPE.supplier_other}, fileUpload:true,xtype:"Application.components.uploadContractForm",componentParent:component,filePanelId:"upload-draft-form",labelWidth:150,parentWin:component,listeners:{cancelled:function(){component.win.close()},uploadComplete:function(response){component.win.close();Main.app.run()}}}]});component.win.show()}};docpanel.buttons.push(button)}return docpanel}function getOtherFilesPanel(){var filesOnPanel=extractFilesByTabIndex(component.files,Application.models.Contract.FILE_TYPE.supplier_other,null); return{xtype:"Application.components.ContractTypedFilesPanel",title:"\u041f\u0440\u043e\u0447\u0438\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044f",files:filesOnPanel,lotInfo:component.lotInfo,tabIndex:null,fileTypeId:Application.models.Contract.FILE_TYPE.supplier_other,signStrategy:[],currentCustomer:component.currentCustomer,currentSupplier:component.currentSupplier,currentOrganizer:component.organizerContragent,uploadContragentType:"supplier", hiddenEmpty:true,enableDeleteLastVersion:true};var filesForContractList=filterFiles(component.files,{type_id:Application.models.Contract.FILE_TYPE.supplier_other});return Ext.apply({},{xtype:"fieldset",title:"1\u0418\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b",hidden:Ext.isEmpty(filesForContractList),items:{xtype:"ux.contractlist",files:filesForContractList,hideEds:true,hide_date_added_col:true}},component.stagePanel)}function saveRequirements(values,cb){component.waitParams["wait_text"]="\u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u043a \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0443"; performRPCCall(RPC.Contract.saveCustomerRequirements,[values],component.waitParams,function(resp){component.remove("contractInfo");initPanel[component.mode]();component.add(component.contractInfo);component.doLayout();redirectToArchiveIdFinalized(resp,"\u0414\u043e\u0433\u043e\u0432\u043e\u0440 \u043d\u0435 \u043d\u0443\u0436\u0434\u0430\u0435\u0442\u0441\u044f \u0432 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u0438, \u043b\u043e\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d \u0432 \u0430\u0440\u0445\u0438\u0432"); if(cb)cb()})}var isCurrentContractCosigned=function(files){return Application.models.Contract.filesCount(files,Application.models.Contract.FILE_TYPE.draft,true,false,true)>0};var initUploadButtons=function(type){var result_buttons={};if(type=="customer"){if(component.lotInfo["status"]!==8&&!component.currentContract.customerSigned&&(component.currentCustomer==Main.user.contragent_id||component.organizerContragent==Main.user.contragent_id)){var text="\u043d\u043e\u0432\u044b\u0439 \u0434\u043e\u0433\u043e\u0432\u043e\u0440"; var uploadTitle="\u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430";if(2==component.signatureRequired){text="\u043e\u0442\u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0434\u043e\u0433\u043e\u0432\u043e\u0440";uploadTitle="\u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"}var contract_drafts=filterFiles(component.files,{type_id:Application.models.Contract.FILE_TYPE.draft, actual:true});if(isEmpty(contract_drafts)||!contract_drafts[0]["date_supplier_eds"])result_buttons.contract=[{text:"\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c "+text,disabled:false,hidden:!!component.mode_additional,handler:function(){component.win=new Ext.Window({autoHeight:true,width:600,closeAction:"close",modal:true,title:"\u0424\u0430\u0439\u043b "+uploadTitle,items:[{width:"100%",border:false,autoheight:true,frame:true,params:{"id":component.lotInfo.id,"currentCustomer":component.currentCustomer, "currentSupplier":component.currentSupplier,"type_id":Application.models.Contract.FILE_TYPE.draft},fileUpload:true,xtype:"Application.components.uploadContractForm",componentParent:component,filePanelId:"upload-draft-form",labelWidth:150,parentWin:component,listeners:{cancelled:function(){component.win.close()},uploadComplete:function(response){component.win.close();Main.app.run()}}}]});component.win.show()}}];var confirmButtonHidden=!component.currentContract.customerSigned&&(component.currentContract.supplierSigned|| 2==component.signatureRequired)&&(component.currentContract.agreed||!component.agreementRequired)&&Application.models.Contract.filesCount(component.files,Application.models.Contract.FILE_TYPE.draft)>0&&component.signatureRequired&&component.currentCustomer==Main.user.contragent_id;if(2==component.signatureRequired)result_buttons.confirm_contract={text:"\u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044c \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430", handler:function(){var params=[{"lot_id":component.lotInfo.id}];component.waitParams["wait_text"]="\u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u043c \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u0432 \u043f\u0438\u0441\u044c\u043c\u0435\u043d\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u0435.";performRPCCall(RPC.Lot.signConfirm,params,component.waitParams,function(resp){confirmedAction(resp)})}}}}else if(Application.models.Contract.filesCount(component.files, Application.models.Contract.FILE_TYPE.draft)>0&&!isCurrentContractCosigned(component.files)){result_buttons.discrepancy_protocol=[{text:"\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c",hidden:!!component.currentContract.supplierSigned||!!component.currentContract["mainSupplierSigned"]||!!component.mode_additional,handler:function(){component.win=new Ext.Window({autoHeight:true,width:600,closeAction:"close",modal:true,title:"\u0424\u0430\u0439\u043b \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 \u0440\u0430\u0437\u043d\u043e\u0433\u043b\u0430\u0441\u0438\u0439", items:[{width:"100%",border:false,autoheight:true,frame:true,params:{"id":component.lotInfo.id,"currentCustomer":component.currentCustomer,"currentSupplier":component.currentSupplier,"type_id":Application.models.Contract.FILE_TYPE.discrepancy,"button_signed_disagreement":true},fileUpload:true,xtype:"Application.components.uploadContractForm",componentParent:component,filePanelId:"upload-discrepancy-form",labelWidth:150,parentWin:component,listeners:{cancelled:function(){component.win.close()},uploadComplete:function(response){component.win.close(); Main.app.run()}}}]});component.win.show()}},{text:"\u041f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c",hidden:component.button_signed_disagreement&&Application.models.Contract.draftsCount(component.files,Application.models.Contract.FILE_TYPE.discrepancy)<1,handler:function(){if(!!Main.user.simple_signing){component.signDate=Ext.util.Format.localDateRenderer(new Date).replace(" ","");var SignText="\u041d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u043c \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u0435\u043c \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 \u0440\u0430\u0437\u043d\u043e\u0433\u043b\u0430\u0441\u0438\u0439 \u043f\u043e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435 "+ component.lotInfo.registry_number+', \u043b\u043e\u0442 "'+component.lotInfo.title+'". '+"\u0417\u0430\u043a\u0430\u0437\u0447\u0438\u043a: "+component.customers[0].full_name+". "+"\u0417\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044c: "+Main.user.full_name+". "+" \u0414\u0430\u0442\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438: "+component.signDate;var parameters={lot_id:component.lotInfo.id,"currentCustomer":component.currentCustomer,"currentSupplier":component.currentSupplier, "type_id":Application.models.Contract.FILE_TYPE.discrepancy};var winItems=[];for(var paramName in parameters)winItems.push({xtype:"hidden",name:paramName,value:parameters[paramName]});var win=new Application.components.promptWindow({title:"\u041f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 \u0440\u0430\u0437\u043d\u043e\u0433\u043b\u0430\u0441\u0438\u0439",cmpType:"Application.components.SignatureForm",parentCmp:component,modal:true, cmpParams:{api:RPC.Contract.actualLastVersion,signatureText:SignText,signatureTextHeight:250,useFormHandler:false,items:winItems,success_fn:function(resp){component.button_signed_disagreement=true;component.fireEvent("reload",component.filePanelId);win.close()}}});win.show()}else CryptoApi.setSigningCertificate(function(certificate,algoOid){loadContractHash(Application.models.Contract.FILE_TYPE.discrepancy,algoOid,function(hash){CryptoApi.signFileByHash({hash:hash},function(signedMessage){var params= {lot_id:component.lotInfo.id,currentCustomer:component.currentCustomer,currentSupplier:component.currentSupplier,type_id:Application.models.Contract.FILE_TYPE.discrepancy,signature:signedMessage,algo:algoOid};performRPCCall(RPC.Contract.actualLastVersion,[params],[],function(resp){if(resp.success){component.button_signed_disagreement=true;component.fireEvent("reload",component.filePanelId)}else alertError(resp.message)})},function(err){Ext.MessageBox.alert("\u041e\u0448\u0438\u0431\u043a\u0430","\u041e\u0448\u0438\u0431\u043a\u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u044f: "+ err)})},function(message){Ext.MessageBox.alert("\u041e\u0448\u0438\u0431\u043a\u0430",message)})})}}];if(component.lotInfo["procedure_type"]!=PROCEDURE_TYPE_PAPER_SINGLE_SUPPLIER)result_buttons.contract_guarantee=[{text:"\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c",hidden:!!component.mode_additional,handler:function(){component.win=new Ext.Window({autoHeight:true,width:600,closeAction:"close",modal:true,title:"\u0424\u0430\u0439\u043b \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430", items:[{width:"100%",border:false,autoheight:true,frame:true,params:{"id":component.lotInfo.id,"currentCustomer":component.currentCustomer,"currentSupplier":component.currentSupplier,"type_id":Application.models.Contract.FILE_TYPE.performance,"button_signed_performance":true},fileUpload:true,xtype:"Application.components.uploadContractForm",componentParent:component,filePanelId:"upload-performance-form",labelWidth:150,parentWin:component,listeners:{cancelled:function(){component.win.close()},uploadComplete:function(response){component.win.close(); Main.app.run()}}}]});component.win.show()}},{hidden:component.button_signed_performance&&Application.models.Contract.draftsCount(component.files,Application.models.Contract.FILE_TYPE.performance)<1,text:"\u041f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c",handler:function(){if(!!Main.user.simple_signing){component.signDate=Ext.util.Format.localDateRenderer(new Date).replace(" ","");var SignText="\u041d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u043c \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u0435\u043c \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u043f\u043e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435 "+ component.lotInfo.registry_number+', \u043b\u043e\u0442 "'+component.lotInfo.title+'". '+"\u0417\u0430\u043a\u0430\u0437\u0447\u0438\u043a: "+component.customers[0].full_name+". "+"\u0417\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044c: "+Main.user.full_name+". "+" \u0414\u0430\u0442\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438: "+component.signDate;var parameters={lot_id:component.lotInfo.id,"currentCustomer":component.currentCustomer,"currentSupplier":component.currentSupplier, "type_id":Application.models.Contract.FILE_TYPE.performance};var winItems=[];for(var paramName in parameters)winItems.push({xtype:"hidden",name:paramName,value:parameters[paramName]});var win=new Application.components.promptWindow({title:"\u041f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430",cmpType:"Application.components.SignatureForm", parentCmp:component,modal:true,cmpParams:{api:RPC.Contract.actualLastVersion,signatureText:SignText,signatureTextHeight:250,useFormHandler:false,items:winItems,success_fn:function(resp){component.button_signed_performance=true;component.fireEvent("reload",component.filePanelId);win.close()}}});win.show()}else CryptoApi.setSigningCertificate(function(certificate,algoOid){loadContractHash(Application.models.Contract.FILE_TYPE.performance,algoOid,function(hash){CryptoApi.signFileByHash({hash:hash},function(signedMessage){var params= {lot_id:component.lotInfo.id,currentCustomer:component.currentCustomer,currentSupplier:component.currentSupplier,type_id:Application.models.Contract.FILE_TYPE.performance,signature:signedMessage,algo:algoOid};performRPCCall(RPC.Contract.actualLastVersion,[params],[],function(resp){if(resp.success){component.button_signed_performance=true;component.fireEvent("reload",component.filePanelId)}else alertError(resp.message)})},function(err){Ext.MessageBox.alert("\u041e\u0448\u0438\u0431\u043a\u0430","\u041e\u0448\u0438\u0431\u043a\u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u044f: "+ err)})},function(message){Ext.MessageBox.alert("\u041e\u0448\u0438\u0431\u043a\u0430",message)})})}}]}else if(!component.currentContract.customerSigned)result_buttons.actions_guarantee=[{text:"\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c",hidden:!!component.mode_additional,handler:function(){component.win=new Ext.Window({autoHeight:true,width:600,closeAction:"close",modal:true,title:"\u0424\u0430\u0439\u043b \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430", items:[{width:"100%",border:false,autoheight:true,frame:true,params:{"id":component.lotInfo.id,"currentCustomer":component.currentCustomer,"currentSupplier":component.currentSupplier,"type_id":Application.models.Contract.FILE_TYPE.performance,"button_signed_performance":true},fileUpload:true,xtype:"Application.components.uploadContractForm",componentParent:component,filePanelId:"upload-performance-form",labelWidth:150,parentWin:component,listeners:{cancelled:function(){component.win.close()},uploadComplete:function(response){component.win.close(); Main.app.run()}}}]});component.win.show()}},{hidden:component.button_signed_performance&&Application.models.Contract.draftsCount(component.files,Application.models.Contract.FILE_TYPE.performance)<1,text:"\u041f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c",handler:function(){if(!!Main.user.simpler_signing){component.signDate=Ext.util.Format.localDateRenderer(new Date).replace(" ","");var SignText="\u041d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u043c \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u0435\u043c \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u043f\u043e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435 "+ component.lotInfo.registry_number+', \u043b\u043e\u0442 "'+component.lotInfo.title+'". '+"\u0417\u0430\u043a\u0430\u0437\u0447\u0438\u043a: "+component.customers[0].full_name+". "+"\u0417\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044c: "+Main.user.full_name+". "+" \u0414\u0430\u0442\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438: "+component.signDate;var parameters={lot_id:component.lotInfo.id,"currentCustomer":component.currentCustomer,"currentSupplier":component.currentSupplier, "type_id":Application.models.Contract.FILE_TYPE.performance};var winItems=[];for(var paramName in parameters)winItems.push({xtype:"hidden",name:paramName,value:parameters[paramName]});var win=new Application.components.promptWindow({title:"\u041f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430",cmpType:"Application.components.SignatureForm", parentCmp:component,modal:true,cmpParams:{api:RPC.Contract.actualLastVersion,signatureText:SignText,signatureTextHeight:250,useFormHandler:false,items:winItems,success_fn:function(resp){component.button_signed_performance=true;component.fireEvent("reload",component.filePanelId);win.close()}}});win.show()}else CryptoApi.setSigningCertificate(function(certificate,algoOid){loadContractHash(Application.models.Contract.FILE_TYPE.performance,algoOid,function(hash){CryptoApi.signFileByHash({hash:hash},function(signedMessage){var params= {lot_id:component.lotInfo.id,currentCustomer:component.currentCustomer,currentSupplier:component.currentSupplier,type_id:Application.models.Contract.FILE_TYPE.performance,signature:signedMessage,algo:algoOid};performRPCCall(RPC.Contract.actualLastVersion,[params],[],function(resp){if(resp.success){component.button_signed_performance=true;component.fireEvent("reload",component.filePanelId)}else alertError(resp.message)})},function(err){Ext.MessageBox.alert("\u041e\u0448\u0438\u0431\u043a\u0430","\u041e\u0448\u0438\u0431\u043a\u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u044f: "+ err)})},function(message){Ext.MessageBox.alert("\u041e\u0448\u0438\u0431\u043a\u0430",message)})})}}];return result_buttons};var initUploadPanel={Customer:function(buttons){if(component.agreementRequired===null&&component.signatureRequired===null&&(component.currentCustomer==Main.user.contragent_id||component.organizerContragent==Main.user.contragent_id)){var decision_form_id=Ext.id();var win=new Ext.Window({title:"\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430", modal:true,closable:false,plugins:[Ext.ux.plugins.LimitSize],applyLayout:true,width:700,items:[{xtype:"Application.components.ProcedureDecisionForm",name:"decision",id:decision_form_id,hideButtons:true,values:{lot:component.lotInfo,suppliers:component.suppliers,customers:component.customers,currency:component.currency,currentCustomer:component.currentCustomer,currentSupplier:component.currentSupplier}}],buttons:[{text:"\u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044c",handler:function(){var decision_form= Ext.getCmp(decision_form_id);var values=decision_form.getValues();saveRequirements(values,function(){win.close();location.reload()})}},{text:"\u041e\u0442\u043c\u0435\u043d\u0430",handler:function(){redirect_to("com/procedure/index");win.close()}}]});win.show()}var buttons_array=buttons.contract||[];if(buttons.confirm_contract)buttons_array.push(buttons.confirm_contract);return{xtype:"panel",border:false,frame:true,title:2==component.signatureRequired?"\u041f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430": "\u0414\u043e\u0433\u043e\u0432\u043e\u0440\u044b",hidden:!buttons.contract&&(Application.models.Contract.filesCount(component.files,Application.models.Contract.FILE_TYPE.draft)>0?false:true)||!component.lotInfo.contract_supplier_id,items:[{xtype:"ux.contractlist",id:"upload-draft-form",hide_date_added_col:true,enableDelete:!!buttons.contract||isAdmin(),enableDeleteLastVersion:true,parentComponent:component,defaults:{anchor:"100%",stateful:true,allowBlank:false,frame:true},files:filterFiles(component.files, {type_id:Application.models.Contract.FILE_TYPE.draft}),selectorName:"unpublished_draft",hideEds:true}],buttonAlign:"center",buttons:buttons_array}},Supplier:function(buttons){return[{xtype:"panel",style:"margin: 5px 0 10px 0",border:false,frame:true,title:"\u041e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430",hidden:!buttons.contract_guarantee&&(Application.models.Contract.filesCount(component.files, Application.models.Contract.FILE_TYPE.performance)>0?false:true),items:[{xtype:"ux.contractlist",id:"upload-performance-form",hidden:Application.models.Contract.filesCount(component.files,Application.models.Contract.FILE_TYPE.performance)>0?false:true,hideEds:true,enableDelete:!!buttons.contract_guarantee,enableDeleteLastVersion:!!buttons.contract_guarantee,parentComponent:component,hide_date_added_col:true,files:filterFiles(component.files,{type_id:Application.models.Contract.FILE_TYPE.performance})}], buttonAlign:"center",buttons:buttons.contract_guarantee||false},generateSubSuppliersSignPanel(filterFiles(component.files,{type_id:Application.models.Contract.FILE_TYPE.performance}),"\u0421\u0442\u0430\u0442\u0443\u0441 \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"),{xtype:"panel",style:"margin: 5px 0 10px 0",border:false,frame:true, title:"\u041f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u044b \u0440\u0430\u0437\u043d\u043e\u0433\u043b\u0430\u0441\u0438\u0439",hidden:!buttons.discrepancy_protocol&&(Application.models.Contract.filesCount(component.files,Application.models.Contract.FILE_TYPE.discrepancy)>0?false:true),items:[{xtype:"ux.contractlist",id:"upload-discrepancy-form",hideEds:true,hidden:Application.models.Contract.filesCount(component.files,Application.models.Contract.FILE_TYPE.discrepancy)>0?false:true,hide_date_added_col:true, enableDelete:!!buttons.discrepancy_protocol,parentComponent:component,files:filterFiles(component.files,{type_id:Application.models.Contract.FILE_TYPE.discrepancy})}],buttonAlign:"center",buttons:buttons.discrepancy_protocol||false},generateSubSuppliersSignPanel(filterFiles(component.files,{type_id:Application.models.Contract.FILE_TYPE.discrepancy}),"\u0421\u0442\u0430\u0442\u0443\u0441 \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u0432 \u0440\u0430\u0437\u043d\u043e\u0433\u043b\u0430\u0441\u0438\u0439")]}}; var initAddAgreementButtons=function(){var additionalAgreement_files=filterFiles(component.files,{type_id:Application.models.Contract.FILE_TYPE.additional_agreement});var buttons=[];var hasSignedAgreement=false;Ext.iterate(additionalAgreement_files,function(item){if(!!item["is_last_version"]&&item["customerSigned"]&&item["supplierSigned"])hasSignedAgreement=true});if(!!hasSignedAgreement)buttons.push({text:"\u041e\u0442\u043a\u0440\u044b\u0442\u044c \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u043c \u0434\u043e\u043f. \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0438", handler:function(){var params={lot_id:component.lot_id,type_id:Application.models.Contract.FILE_TYPE.additional_agreement,signed:"both"};performAjaxRPCCall("/contract/generateSignProtocol",params,{download:true,wait_disable:true})}});return buttons};var initContractPanelItems=function(contractPanels,additionalPanels){var items=[];var contractPanelItems=[];Ext.iterate(contractPanels,function(name,panel){if(!isEmpty(panel))contractPanelItems.push(panel)});items.push({title:"\u0414\u043e\u0433\u043e\u0432\u043e\u0440", items:contractPanelItems});Ext.iterate(additionalPanels,function(additionalPanel,i){items.push({title:"\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435 #"+(i+1),items:[additionalPanel]})});if(Main.contragent.id==component.currentCustomer&&component.currentContract&&component.currentContract["supplierSigned"])items.push({title:"\u041d\u043e\u0432\u043e\u0435 \u0434\u043e\u043f. \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435", addItemHandler:true,iconCls:"icon-silk-add"});return items};var initContractTabPanel=function(contractPanels,additionalPanels){var tabPanel=new Ext.TabPanel({activeTab:parseInt(component.activeTab),frame:true,enableTabScroll:true,defaults:{autoHeight:true,frame:true,padding:5},items:initContractPanelItems(contractPanels,additionalPanels),listeners:{beforetabchange:function(tp,newtab){if(newtab&&newtab.addItemHandler){tp.addAdditionalPanelsTab();return false}return true},tabchange:function(tp,newtab){var dButton= Ext.getCmp(component.download_all_button_id);if(dButton){var filesPanel=newtab.findByType("Application.components.AdditionalContractFilesPanel").shift();if(filesPanel&&filesPanel.files&&filesPanel.files.length){dButton.file_link=filesPanel.files[0].link;dButton.setText(dButton.template_text+"\u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f");return true}filesPanel=newtab.findByType("ux.contractlist").shift(); if(filesPanel&&filesPanel.files&&filesPanel.files.length){dButton.file_link=filesPanel.files[0].link;dButton.setText(dButton.template_text+"\u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430");return true}}}},isPreviousPanelHasFiles:function(){prevPos=this.items.getCount()-1;var prev_panel=this.items.get(prevPos-1);var hasFiles=false;if(prev_panel)if(prev_panel.items.get(0).items.get(0)&&prev_panel.items.get(0).items.get(0).xtype==="Application.components.AdditionalContractFilesPanel")hasFiles=!isEmpty(prev_panel.items.get(0).items.get(0).files); return hasFiles},addAdditionalPanelsTab:function(){var insPos=this.items.getCount()-1;if(insPos>1&&!this.isPreviousPanelHasFiles())return false;var newTab={title:"\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435 #"+insPos,items:[getAdditionalAgreementPanel(null,insPos)]};this.insert(insPos,newTab);if(this.rendered)this.doLayout();this.setActiveTab.defer(100,this,[insPos]);return this}});return tabPanel}; var initPanel={View:function(){if(isSupplier()&&!isCustomer());var stageCustomerLoaded=getCustomerLoadedPanel();var stageSupplierAgreed=getSupplierSignedPanel();var repudiationPanel=getCustomerRepudiationPanel();var customerOthersPanel=getCustomerOthersPanel();if(repudiationPanel);var otherFilesPanel=getOtherFilesPanel(component.files,component.stagePanel);component.contractInfo.items=[initContractTabPanel({"customer":stageCustomerLoaded,"supplier":stageSupplierAgreed,"supplier_others":otherFilesPanel, "customer_others":customerOthersPanel,"repudiation":repudiationPanel},initAdditionalPanels())]},Admin:function(){initPanel["View"]()},Customer:function(){component.uploadPanelId=Ext.id();var fieldset_title="\u0421\u0442\u0430\u0434\u0438\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u043e\u043c";if(2==component.signatureRequired)fieldset_title="\u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"; if(component.currentContract.agreed&&component.lotInfo.status==7&&component.signatureRequired)fieldset_title="\u0421\u0442\u0430\u0434\u0438\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u043e\u043c";if(component.lotInfo.status==8)fieldset_title="\u0414\u043e\u0433\u043e\u0432\u043e\u0440, \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0443\u043f\u043e\u043b\u043d\u043e\u043c\u043e\u0447\u0435\u043d\u043d\u044b\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043b\u0435\u043c \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u0430"; var stageDraft=Ext.apply({},{title:fieldset_title,id:component.uploadPanelId,bodyCssClass:"subpanel",items:[],buttons:[]},component.stagePanel);if(component.agreementRequired===false&&2!=component.signatureRequired)stageDraft.items.push(component.agreedNotNeededPanel);if(2==component.signatureRequired)stageDraft.items.push(generateInfoPanel("\u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u044b\u0431\u043e\u0440\u0430 \u043f\u0438\u0441\u044c\u043c\u0435\u043d\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u044b \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430, \u0412\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044c \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e "+ (!Main.config.contract_final_step?"\u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0430 \u0432 \u0430\u0440\u0445\u0438\u0432 \u0438 ":"")+'\u0434\u0435\u043d\u0435\u0436\u043d\u044b\u0435 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 \u0443 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u0432 \u0440\u0430\u0437\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0442\u0441\u044f. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0443\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430 \u043e\u0442 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430, \u0412\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0442\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430 \u0438 \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0442\u043a\u0430\u0437\u0430 \u0432 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0438 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430 "\u0423\u043a\u043b\u043e\u043d\u0438\u043b\u0441\u044f \u043e\u0442 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430", \u0434\u0435\u043d\u0435\u0436\u043d\u044b\u0435 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 \u0443\u043a\u043b\u043e\u043d\u0438\u0441\u0442\u0430 \u043e\u0441\u0442\u0430\u043d\u0443\u0442\u0441\u044f \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0442\u043a\u0430\u0437\u0430 \u043e\u0442 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u0441 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u00ab\u0418\u043d\u043e\u0435\u00bb, \u0434\u0435\u043d\u0435\u0436\u043d\u044b\u0435 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 \u0443 \u043f\u043e\u0431\u0435\u0434\u0438\u0442\u0435\u043b\u044f \u0440\u0430\u0437\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0442\u0441\u044f.')); var upload_buttons=initUploadButtons("customer");stageDraft.items.push(initUploadPanel["Customer"](upload_buttons));if(component.currentContract.customerSigned){var date_customer_eds="";if(component.currentContract.date_customer_eds)date_customer_eds=", "+Ext.util.Format.localDateText(parseDate(component.currentContract.date_customer_eds));var confirm_text="\u0414\u043e\u0433\u043e\u0432\u043e\u0440 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u043e\u043c"; if(2==component.signatureRequired)confirm_text="\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u043e";stageDraft.items.push(generateInfoPanel(confirm_text+date_customer_eds+".",true,"customer"))}if(!component.currentContract.customerSigned&&component.currentContract.supplierSigned&&(component.currentContract.agreed||!component.agreementRequired)&&Application.models.Contract.filesCount(component.files, Application.models.Contract.FILE_TYPE.draft)>0&&component.signatureRequired&&component.currentCustomer==Main.user.contragent_id)stageDraft.items.push({xtype:"fieldset",frame:false,border:true,buttonAlign:"center",style:"margin-top: 10px; margin-bottom: 0px; padding: 5px 0",buttons:[{text:"\u041f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c \u0434\u043e\u0433\u043e\u0432\u043e\u0440",handler:function(){component.fireEvent("customerSigned")}}]});var repudiationPanel=getCustomerRepudiationPanel(); var supplierOthersPanel=getSupplierOthersPanel();var customerOthersPanel=getCustomerOthersPanel();component.contractInfo.items=[initDualModePanel(),stageDraft,getSupplierSignedPanel()];if(repudiationPanel)component.contractInfo.items.push(repudiationPanel);if(supplierOthersPanel)component.contractInfo.items.push(supplierOthersPanel);if(isAdditionalAgreementPanelVisible())component.contractInfo.items.push(getAdditionalAgreementPanel());if(customerOthersPanel)component.contractInfo.items.push(customerOthersPanel)}, Supplier:function(){component.uploadPanelId=Ext.id();var fieldset_title="\u0421\u0442\u0430\u0434\u0438\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u0435\u043c";if(component.currentContract.agreed&&component.lotInfo.status==7&&component.signatureRequired&&2!=component.signatureRequired)fieldset_title="\u0421\u0442\u0430\u0434\u0438\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u0435\u043c"; if(component.lotInfo.status==8)fieldset_title="\u0414\u043e\u0433\u043e\u0432\u043e\u0440, \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0443\u043f\u043e\u043b\u043d\u043e\u043c\u043e\u0447\u0435\u043d\u043d\u044b\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043b\u0435\u043c \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044f";var stageSupplierSign=Ext.apply({},{title:fieldset_title,id:component.uploadPanelId,items:[],buttons:[]},component.stagePanel); stageSupplierSign.items=[];if(component.lotInfo.contract_supplier_id==component.currentSupplier){if(component.currentContract.supplierSigned){var date_supplier_eds="";if(component.currentContract.date_supplier_eds)date_supplier_eds=", "+Ext.util.Format.localDateText(parseDate(component.currentContract.date_supplier_eds));stageSupplierSign.items.push(generateInfoPanel("\u0414\u043e\u0433\u043e\u0432\u043e\u0440 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u0435\u043c"+ date_supplier_eds+".",false,"supplier"))}else{if(component.currentContract.agreed);else if(component.agreementRequired){if(component.currentContract.id)stageSupplierSign.items.push(component.notAgreedPanel);if(component.lotInfo.status==7&&Application.models.Contract.filesCount(component.files,Application.models.Contract.FILE_TYPE.draft)==0)stageSupplierSign.items.push(generateInfoPanel(component.wait_customer_requirements_text))}if(!component.currentContract.supplierSigned&&component.currentContract.agreed&& component.signatureRequired&&2!=component.signatureRequired&&!component.supplierRefusedSign){var supplier_last_sign_date=Ext.util.Format.localDateOnlyRenderer(parseDate(component.currentContract.date_agreed_end,"c"));var is_supplier_can_sign=isSupplierCanSign();stageSupplierSign.items.push({xtype:"fieldset",frame:false,border:true,buttonAlign:"center",style:"padding: 5px 0;",buttons:[{text:"\u041f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c \u0434\u043e\u0433\u043e\u0432\u043e\u0440",hidden:!is_supplier_can_sign, handler:function(){component.fireEvent("supplierSigned")}}]})}}if(component.currentContract["additional_suppliers_data"]){var main_supplier=getSupplierInfo(component.currentContract["supplier_id"]);var suppliers={0:{supplier_full_name:""+main_supplier["full_name"]+"",supplier_short_name:main_supplier["short_name"],date_signed:parseDate(component.currentContract["date_supplier_eds"]),status:component.currentContract["date_supplier_eds"]?1:0}};Ext.apply(suppliers,component.currentContract["additional_suppliers_data"]); stageSupplierSign.items.push(getSubSuppliersSignPanel(suppliers,false,component.currentContract["id"]))}}else stageSupplierSign.items.push(generateInfoPanel("\u0414\u043e\u0433\u043e\u0432\u043e\u0440 \u0441 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u043c \u043d\u0435 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f."));var upload_buttons={};if(component.lotInfo.contract_supplier_id==component.currentSupplier)upload_buttons=initUploadButtons("supplier");else upload_buttons= false;stageSupplierSign.items.push(initUploadPanel["Supplier"](upload_buttons));var stageCustomerLoaded=getCustomerLoadedPanel();var otherFilesPanel=getSupplierOthersPanel();var repudiationPanel=getCustomerRepudiationPanel();var customerOthersPanel=getCustomerOthersPanel();component.contractInfo.items=[initDualModePanel(),stageCustomerLoaded];var need_supplier_panel=false;for(var i=0;i\u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u043f\u043e\u0434\u043e\u0436\u0434\u0438\u0442\u0435'}],listeners:{reload:function(id){if(component.win)component.win.close();performRPCCall(RPC.Contract.loadFiles,[{lot_id:component.lot_id,customer_id:component.customer_id,supplier_id:component.supplier_id}],component.waitParams,function(resp){component.remove(waitId);component.files= resp.files;setCurrentContract(resp.currentContract);component.remove("contractInfo");initPanel[component.mode]();component.add(component.contractInfo);component.doLayout()})},agreed:function(){component.waitParams["wait_text"]="\u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u0435";performRPCCall(RPC.Contract.contractAgreed,[{lot_id:component.lot_id,contract_id:component.currentContract.id}],component.waitParams,function(resp){component.remove("contractInfo"); component.lotInfo=resp.lotInfo;setCurrentContract(resp.currentContract);initPanel["Supplier"]();component.add(component.contractInfo);component.doLayout();echoResponseMessage(resp);redirectToArchiveIdFinalized(resp,"\u0414\u043e\u0433\u043e\u0432\u043e\u0440 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430\u043c\u0438, \u043b\u043e\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d \u0432 \u0430\u0440\u0445\u0438\u0432")})}, agreementApproved:function(){component.waitParams["wait_text"]="\u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u043c";performRPCCall(RPC.Contract.agreementApproved,[{lot_id:component.lot_id,contract_id:component.currentContract.id}],component.waitParams,function(resp){component.remove("contractInfo");component.lotInfo=resp.lotInfo;setCurrentContract(resp.currentContract);initPanel["Customer"]();component.add(component.contractInfo);component.doLayout();echoResponseMessage(resp); redirectToArchiveIdFinalized(resp,"\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u043e, \u043b\u043e\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d \u0432 \u0430\u0440\u0445\u0438\u0432")})},customerSigned:function(){if(!!Main.user.simple_signing){component.waitParams["wait_text"]="\u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c";var sign_window= null;if(component.sign_window_id)sign_window=Ext.getCmp(component.sign_window_id);if(!sign_window){component.sign_window_id=Ext.id();var win=new Application.components.promptWindow({title:"\u041f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430",cmpType:"Application.components.SignatureForm",parentCmp:this,id:component.sign_window_id,cmpParams:{api:RPC.Contract.sign,signatureText:makeText("\u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u043e\u043c"), signatureTextHeight:250,useFormHandler:false,simpler_signing:true,items:getSignActionItems("customer",true),success_fn:function(resp){signedAction(resp,win)}}});win.show()}}else CryptoApi.setSigningCertificate(function(certificate,algoOid){loadContractHash(Application.models.Contract.FILE_TYPE.draft,algoOid,function(hash){CryptoApi.signFileByHash({hash:hash},function(signedMessage){var params={lot_id:component.lot_id,contract_id:component.currentContract.id,type:"customer",signDate:component.signDate, signature:signedMessage,algo:algoOid,supplier_id:component.currentSupplier,customer_id:component.currentCustomer};performRPCCall(RPC.Contract.sign,[params],[],function(resp){if(resp.success)signedAction(resp);else alertError(resp.message)})},function(err){Ext.MessageBox.alert("\u041e\u0448\u0438\u0431\u043a\u0430","\u041e\u0448\u0438\u0431\u043a\u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u044f: "+err)})},function(message){Ext.MessageBox.alert("\u041e\u0448\u0438\u0431\u043a\u0430", message)})})},supplierSigned:function(){if(!!Main.user.simple_signing){component.waitParams["wait_text"]="\u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c";var sign_window=null;if(component.sign_window_id)sign_window=Ext.getCmp(component.sign_window_id);if(!sign_window){component.sign_window_id=Ext.id();var win=new Application.components.promptWindow({title:"\u041f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430",cmpType:"Application.components.SignatureForm", parentCmp:this,id:component.sign_window_id,cmpParams:{api:RPC.Contract.sign,signatureText:makeText("\u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u0435\u043c"),signatureTextHeight:250,useFormHandler:false,items:getSignActionItems("supplier",true),success_fn:function(resp){signedAction(resp,win)}}});win.show()}}else CryptoApi.setSigningCertificate(function(certificate,algoOid){loadContractHash(Application.models.Contract.FILE_TYPE.draft,algoOid,function(hash){CryptoApi.signFileByHash({hash:hash}, function(signedMessage){var params={lot_id:component.lot_id,contract_id:component.currentContract.id,type:"supplier",signDate:component.signDate,signature:signedMessage,algo:algoOid,supplier_id:component.currentSupplier,customer_id:component.currentCustomer};performRPCCall(RPC.Contract.sign,[params],[],function(resp){if(resp.success)signedAction(resp);else alertError(resp.message)})},function(err){Ext.MessageBox.alert("\u041e\u0448\u0438\u0431\u043a\u0430","\u041e\u0448\u0438\u0431\u043a\u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u044f: "+ err)})},function(message){Ext.MessageBox.alert("\u041e\u0448\u0438\u0431\u043a\u0430",message)})})}}});Application.components.ContractListPanel.superclass.initComponent.call(this);performRPCCall(RPC.Contract.load,[{lot_id:component.lot_id,customer_id:component.customer_id,supplier_id:component.supplier_id,as_mode:component.as_mode}],component.waitParams,function(resp){if(resp.finalized===true){Ext.MessageBox.alert("\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430", resp.message,function(){redirect_to("com/procedure/index/type/archive")});return}component.remove(waitId);loadContractReponse(resp);if(!component.currentContract)component.currentContract={"agreed":false,"id":null};initPanel[component.mode]();if(resp.lotInfo.status==8)if(resp.contract_eds_text){component.lotInfoButtons.push({text:"\u0421\u043a\u0430\u0447\u0430\u0442\u044c \u0432\u0441\u0435 \u0444\u0430\u0439\u043b\u044b \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u0432 \u0432\u0438\u0434\u0435 \u0430\u0440\u0445\u0438\u0432\u0430", template_text:"\u0421\u043a\u0430\u0447\u0430\u0442\u044c \u0432\u0441\u0435 \u0444\u0430\u0439\u043b\u044b ",id:component.download_all_button_id,file_link:"",hidden:!isAdmin()&&!inArrayOfObjects(component["customers"],"id",Main.user.contragent_id)&&component.organizerContragent!=Main.user.contragent_id&&component.lotInfo.winner_id!=Main.user.contragent_id&&!(component.currentContract.supplier_id==Main.user.contragent_id||inArrayOfObjects(component.currentContract.additional_suppliers_data,"id",Main.user.contragent_id)), handler:function(){var params={full_zip:1};if(!this.file_link)this.file_link=component.contract_file.link;performAjaxRPCCall(this.file_link,params,{download:true,wait_disable:true},echoResponseMessage)}});component.lotInfoButtons.push({text:"\u041e\u0442\u043a\u0440\u044b\u0442\u044c \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u043c \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0435",hidden:!isAdmin()&&!inArrayOfObjects(component["customers"], "id",Main.user.contragent_id)&&component.organizerContragent!=Main.user.contragent_id&&component.lotInfo.winner_id!=Main.user.contragent_id&&!(component.currentContract.supplier_id==Main.user.contragent_id||inArrayOfObjects(component.currentContract.additional_suppliers_data,"id",Main.user.contragent_id)),handler:function(){var params={lot_id:component.lot_id,contract_id:component.currentContract.id};performAjaxRPCCall("/contract/generateSignProtocol",params,{download:true,wait_disable:true})}})}if(component.lotInfo["procedure_type"]== 10){component.lotInfoButtons.push({text:"\u0410\u043a\u043a\u0440\u0435\u0434\u0438\u0442\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f",hidden:!resp["currentSupplier"],handler:function(){redirect_to("company/view/id/"+component.currentSupplier+"/withProcuracyFiles/1/withBank/1")}});component.lotInfoButtons.push({text:"\u0418\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u0430",hidden:isSupplier()&& component.organizerContragent!=Main.contragent.id||!resp["currentSupplier"]||component.currentContract.supplierSigned,handler:function(){performRPCCall(RPC.Contract.clearContractSupplier,[{id:component.lot_id}],{confirm:"\u0412\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u0430?"}, function(resp){if(!!resp.success)window.location.reload(true);else echoResponseMessage(resp)})}})}else if(component.suppliers.length!=0)component.lotInfoButtons.push({text:"\u0420\u0435\u043a\u0432\u0438\u0437\u0438\u0442\u044b \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430",hidden:resp["signatureRequired"]==null,handler:function(){Application.models.Contract.showSupplierRecs(component.currentSupplier,component.suppliers,component.additional_suppliers||[])}});else component.lotInfoButtons.push({text:"\u0420\u0435\u043a\u0432\u0438\u0437\u0438\u0442\u044b \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430", hidden:resp["signatureRequired"]==null,handler:function(){Application.models.Contract.showSupplierInfoDialog(component.currentSupplierInfo)}});var lot_data={"lot":resp.lotInfo,"suppliers":resp.suppliers,"customers":resp.customers,"current_customer":resp.currentCustomer,"current_supplier":resp.currentSupplier,"current_supplier_info":resp.currentSupplierInfo,"currency":resp.currency,"agreement_required":resp.agreementRequired,"signature_required":resp.signatureRequired};var info_items=Application.models.Contract.renderParticipants(lot_data); component.addAgreementButtons=initAddAgreementButtons();info_items.push({xtype:"panel",border:false,frame:false,buttons:component.lotInfoButtons});if(component.addAgreementButtons)info_items.push({xtype:"panel",border:false,frame:false,buttons:component.addAgreementButtons});component.add(Application.models.Contract.renderLotInfo(lot_data,resp.currentContract,resp.mode),{xtype:"fieldset",defaults:{anchor:"100%",stateful:true,allowBlank:false,frame:true},title:"\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0434\u043e\u0433\u043e\u0432\u0430\u0440\u0438\u0432\u0430\u044e\u0449\u0438\u0445\u0441\u044f \u0441\u0442\u043e\u0440\u043e\u043d\u0430\u0445", items:info_items},component.contractInfo);component.doLayout()})},changeToTab:function(tabIndex){var currentToken=window.HistoryManager.getToken();var tokensArray=currentToken.split("/");var pos=tokensArray.indexOf("tab");if(pos>-1)tokensArray[pos+1]=tabIndex;else{tokensArray.push("tab");tokensArray.push(tabIndex)}window.HistoryManager.add(tokensArray.join("/"))}});Ext.define("Application.components.ContractLotInfo",{extend:"Ext.Panel",data:[],initComponent:function(){var component=this;var items=component.renderPanel(component.data);Ext.apply(component,{items:[items]});Application.components.ContractLotInfo.superclass.initComponent.call(component)},renderPanel:function(data){return Application.models.Contract.renderLotInfo(data)}});Ext.define("Application.components.ContractOOSPublishForm",{extend:"Ext.panel.Panel",frame:true,border:false,bodyCssClass:"subpanel",initComponent:function(){var component=this;var oos_fieldset_id=Ext.id(),name_id=Ext.id(),sum_info_id=Ext.id(),term_info_id=Ext.id();Ext.apply(this,{items:[{xtype:"fieldset",title:"\u0414\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u043d\u0430 zakupki.gov.ru", id:oos_fieldset_id,labelWidth:350,defaults:{bodyStyle:"padding: 0px"},items:[{xtype:"textfield",name:"name",anchor:"100%",id:name_id,fieldLabel:"\u041d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"+REQUIRED_FIELD,allowBlank:false,blankText:"\u041f\u043e\u043b\u0435 \u041d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f"}, {xtype:"textfield",name:"sum_info",anchor:"100%",id:sum_info_id,fieldLabel:"\u0421\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e \u0441\u0443\u043c\u043c\u0435 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u043e\u0433\u043e \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430",qtipConfig:{title:"\u0421\u0443\u043c\u043c\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u043e\u0433\u043e "+t("\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430"),html:"

\u0415\u0441\u043b\u0438 \u0412\u044b \u043d\u0435 \u0432\u0432\u0435\u0434\u0435\u0442\u0435 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u044d\u0442\u043e \u043f\u043e\u043b\u0435, \u043d\u0430 \u0415\u0418\u0421 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f "+ " \u043e\u0431 \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0446\u0435\u043d\u0435 \u043b\u043e\u0442\u0430, \u0440\u0430\u0432\u043d\u0430\u044f \u0446\u0435\u043d\u0435 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430-\u043f\u043e\u0431\u0435\u0434\u0438\u0442\u0435\u043b\u044f.

",autoHide:false,applyTipTo:"label"},plugins:[Ext.ux.plugins.ToolTip]},{xtype:"textfield",name:"term_info", anchor:"100%",id:term_info_id,fieldLabel:"\u0421\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e \u0441\u0440\u043e\u043a\u0430\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u043e\u0433\u043e \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430",qtipConfig:{title:"\u0421\u0440\u043e\u043a \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u043e\u0433\u043e \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430", html:'

\u0415\u0441\u043b\u0438 \u0412\u044b \u043d\u0435 \u0432\u0432\u0435\u0434\u0435\u0442\u0435 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u044d\u0442\u043e \u043f\u043e\u043b\u0435, \u0432 \u043f\u043e\u043b\u0435 "\u0421\u0440\u043e\u043a \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430" \u043d\u0430 \u0415\u0418\u0421 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u043d \u0442\u0435\u043a\u0441\u0442 «\u0443\u043a\u0430\u0437\u0430\u043d \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u043c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0435».

', autoHide:false,applyTipTo:"label"},plugins:[Ext.ux.plugins.ToolTip]}]}],buttons:[{text:"\u041f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u043d\u0430 zakupki.gov.ru",handler:function(){var me=component;var values={contract_id:component.contract_id};collectComponentValues(component,values,true);performRPCCall(RPC.Contract.oosqueue,[values],{wait_delay:0,wait_text:t("\u041a\u043e\u043d\u0442\u0440\u0430\u043a\u0442")+" \u0441\u0442\u0430\u0432\u0438\u0442\u0441\u044f \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043d\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044e..."}, function(result){if(result.success){echoResponseMessage(result);if(me.winId){Ext.getCmp(me.winId).close();Ext.getCmp(me.buttonId).hide()}}else echoResponseMessage(result)})}},{text:"\u041e\u0442\u043c\u0435\u043d\u0438\u0442\u044c",handler:function(){if(component.winId)Ext.getCmp(component.winId).close()}}],listeners:{beforerender:function(){performRPCCall(RPC.Contract.oosdata,[{contract_id:component.contract_id},{message_type:component["type"]}],{wait_delay:0,wait_text:"\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u044e\u0442\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u0435 "+ t("\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430")+". \u041f\u043e\u0434\u043e\u0436\u0434\u0438\u0442\u0435..."},function(result){if(result.success&&result.contract_data)setComponentValues(component,result.contract_data,true);else echoResponseMessage(result)})}}});Application.components.ContractOOSPublisForm.superclass.initComponent.call(this)}});Ext.define("Application.components.ContractRegistryPublishForm",{extend:"Ext.form.FormPanel",frame:true,border:false,bodyCssClass:"subpanel",contract_id:null,contragent_id:null,message_type:null,procedureData:null,initComponent:function(){var component=this;component.panel_ids=initIds(["panel1","panel2","panel3","panel4","panel5","reason_fieldset"]);component.contract_date=Ext.id();component.currency_rate_id=Ext.id();component.supplier_info_id=Ext.id();component.contract_common_panel_id=component.panel_ids["panel1"]; component.addEvents("submitForm");Ext.apply(this,{items:[{xtype:"Application.components.PlanPositionSelectPanel",contragentId:component.contragent_id,data:{},name:"contract_registry_plan_position",hidden:!isAdmin()&&!in_array(10,Main.user.roles)&&!in_array(5,Main.user.roles),ref:"contractRegistryPlanPositionSelectPanelCmp",listeners:{onselect:function(data){if(isEmpty(data))return;component.doLayout();var values={};collectComponentValues(component,values);values["common"]["purchase_method_code"]= data["purchase_method_code"];values["common"]["subject"]=data["contract_subject"];values["common"]["is_digital_form"]=data["is_electronic"];var positions=[];if(!isEmpty(data["plan_purchase_item_rows"])&&data["plan_purchase_item_rows"].length>0)Ext.iterate(data["plan_purchase_item_rows"],function(row){positions.push({"unit_guid":row["guid"],"unit_name":row["okpd2"]["name"]||"","unit_okei":!isEmpty(row["okei"])?row["okei"]["code"]:"","unit_okpd2":!isEmpty(row["okpd2"])?row["okpd2"]["code"]:"","unit_pos":row["ordinal_number"]|| "","unit_quantity":row["qty"]||""})});values["subject_info"]["positions"]=positions;values["contract_registry_plan_position"]=data;setComponentValues(component,values);Ext.getCmp(component.contract_common_panel_id).fireEvent("custom_purchase_plan_item_selected",data["guid"])},removed:function(){var values={};collectComponentValues(component,values);values["common"]["purchase_method_code"]=null;values["common"]["subject"]=null;values["common"]["is_digital_form"]=null;values["subject_info"]["positions"]= [];setComponentValues(component,values);Ext.getCmp(component.contract_common_panel_id).fireEvent("custom_purchase_plan_item_selected",null)}}},{xtype:"Application.components.FormFieldsetContainer",name:"update",ref:"contractUpdateWrapper",hidden:true,disabled:true,title:"",items:[{xtype:"Application.components.ContractUpdatePanel",ref:"../contractUpdatePanel"}]},{xtype:"Application.components.FormFieldsetContainer",name:"common",title:"\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0435", items:[{xtype:"Application.components.ContractCommonPanel",id:component.contract_common_panel_id,parent:component,contract_id:component.contract_id||null}]},{xtype:"fieldset",title:"\u041e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u043b\u044f \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"+REQUIRED_FIELD,labelWidth:400,id:component.panel_ids.reason_fieldset,defaults:{labelWidth:400},items:[{xtype:"panel",frame:false,border:false, padding:"0 0 10px 0",html:"\u041f\u043e \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044e zakupki.gov.ru \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u0439 \u043e \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430, \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0445\u043e\u0442\u044f \u0431\u044b \u043e\u0434\u043d\u043e \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u043b\u044f \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430. \u0423\u043a\u0430\u0437\u0430\u043d\u0438\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u043b\u044f \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0434\u043b\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f."}, {xtype:"Application.components.ContractConfirmingProtocolsDocsGrid",name:"contract_confirming_docs",contract_id:component.contract_id,id:component.panel_ids["panel2"],autoHeight:true},{html:" "},{xtype:"Application.components.ContractConfirmingOtherDocsGrid",name:"contract_confirming_other_docs",contract_id:component.contract_id,id:component.panel_ids["panel5"],autoHeight:true}]},{xtype:"Application.components.FormFieldsetContainer",title:"\u0414\u0430\u043d\u043d\u044b\u0435 \u043e \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u0435", name:"contragent",items:[{xtype:"Application.components.ContractContragentPanel",id:component.panel_ids["panel3"]}]},{xtype:"Application.components.FormFieldsetContainer",title:"\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u0435 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430",name:"subject_info",items:[{xtype:"Application.components.ContractSubjectInfoPanel",id:component.panel_ids["panel4"],ref:"../contractSubjectInfoPanel",contract_id:component.contract_id}]}, {xtype:"Application.components.FormFieldsetContainer",title:"\u0414\u043e\u0433\u043e\u0432\u043e\u0440\u044b \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438",labelWidth:350,items:[{xtype:"Application.components.ContractFilesGridPanel",name:"contract_files",autoHeight:true,ref:"../contractFilesGridPanelCmp"},{padding:"10px 0",html:"* \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u043a \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0443 \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u0438\u043a\u0440\u0435\u043f\u043b\u0435\u043d\u044b \u0444\u0430\u0439\u043b\u044b \u043f\u043e\u0434\u043f\u0438\u0441\u0435\u0439 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u0432 \u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0442\u0430\u0445"}]}], buttons:[{text:"\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c",handler:function(){component.fireEvent("submitForm",false)}},{text:"\u041e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c",handler:function(){component.fireEvent("submitForm",true)}},{text:"\u041d\u0430\u0437\u0430\u0434",handler:function(){history.back(1)}}],listeners:{submitForm:function(sent_to_oos){var component=this;var sent_to_oos=sent_to_oos||false;var invalid=component.getInvalid();var form_validation_result=null;Ext.iterate(component.panel_ids, function(i,cmp_id){var cmp=Ext.getCmp(cmp_id);form_validation_result=isFormValidAdvanced(cmp);if(form_validation_result!==true)return false});if(form_validation_result!==true){alertFormErrors(form_validation_result);return false}Ext.apply(invalid,component.contractSubjectInfoPanel.posGridCmp.validate());if(!!sent_to_oos&&!isEmpty(invalid)){var invalid_titles=[];Ext.iterate(invalid,function(invalid_item){var title=invalid_item.fieldLabel||invalid_item;if(title){title=title.replace(REQUIRED_FIELD,""); invalid_titles.push(title)}});alertError("\u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u0432\u0441\u0435 \u043f\u043e\u043b\u044f \u0444\u043e\u0440\u043c\u044b:
- "+invalid_titles.join("
- "));return false}var values={sent_to_oos:!!sent_to_oos,contract_id:component.contract_id,message_type:component["message_type"],data:{}};collectComponentValues(component,values["data"],true);var panel3=Ext.getCmp(component.panel_ids["panel3"]); if(panel3&&panel3.suppliersData){panel3.collectContragentData();var suppErrors=[];Ext.iterate(panel3.suppliersData,function(index,supp){panel3.items.each(function(e){if(!!e.isVisible()&&!e.disabled)if(supp[e.name]!==undefined&&!supp[e.name]){var title=e.fieldLabel;if(title){title=title.replace(REQUIRED_FIELD,"");suppErrors.push(title)}}})});if(suppErrors.length){alertError("\u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u0432\u0441\u0435 \u043f\u043e\u043b\u044f \u0444\u043e\u0440\u043c\u044b:
- "+ suppErrors.join("
- "));return false}values["data"]["additional_suppliers_data"]=panel3.suppliersData}if(!component.validateFormValues(values))return false;if(sent_to_oos&&isEmpty(values["data"]["contract_confirming_docs"])&&isEmpty(values["data"]["contract_confirming_other_docs"])&&!values["data"]["common"]["notice_no_5_4_223"]){alertError("\u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u0443\u043a\u0430\u0436\u0438\u0442\u0435 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u043b\u044f \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"); return false}if(!!values["data"]["common"]["notice_no_5_4_223"]&&isEmpty(values["data"]["contract_confirming_docs"])&&isEmpty(values["data"]["contract_confirming_other_docs"])&&component.procedureData["procedure_type"]==PROCEDURE_TYPE_PAPER_SINGLE_SUPPLIER){alertError("\u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u0443\u043a\u0430\u0436\u0438\u0442\u0435 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u043b\u044f \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"); return false}if(sent_to_oos&&values["data"]&&(values["data"]["currency"]&&values["data"]["subject_info"]["currency"]!==810&&!values["data"]["subject_info"]["currency_rate"])){alertError("\u041d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d \u043a\u0443\u0440\u0441 \u0432\u0430\u043b\u044e\u0442\u044b");return}values["version"]=values["data"]["common"]["version"];performRPCCall(RPC.Contract.oosqueue,[values],{wait_delay:0,wait_text:sent_to_oos?"\u0421\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043d\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044e...": "\u0414\u0430\u043d\u043d\u044b\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442\u0441\u044f"},function(result){echoResponseMessage(result)})},beforerender:function(){var contractDocsGrid=Ext.getCmp(component.panel_ids["panel2"]);var otherDocsGrid=Ext.getCmp(component.panel_ids["panel5"]);contractDocsGrid.relayEvents(otherDocsGrid,["otherDocsChecked"]);otherDocsGrid.relayEvents(contractDocsGrid,["protocolDocsChecked"]);performRPCCall(RPC.Contract.oosdata,[{contract_id:component.contract_id, message_type:component["message_type"]}],{wait_delay:0,wait_text:"\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u044e\u0442\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u0435 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430. \u041f\u043e\u0434\u043e\u0436\u0434\u0438\u0442\u0435..."},function(result){if(result.success){if(!isEmpty(result["contract_data"])){var data=result["contract_data"]||{};if(!data["common"])data["common"]={};data["common"]["version"]=!isEmpty(result["oos_info"])?result["oos_info"]["version"]: 1;if(data["common"]["oos_registry_number"]==""&&!isEmpty(result["oos_info"]))data["common"]["oos_registry_number"]=result["oos_info"]["oos_registry_number"]}else{var lotData=result.lot_data,procedureData=result.procedure_data,oosInfo=result.oos_info,contract=result.contract,positions=result.positions,second_parts_protocol_date=result.second_parts_protocol_date,data={common:{lot_num:lotData.number,subject:lotData.subject,registration_number:contract["registration_number"]||null,contract_date:contract["date_customer_eds"]|| null,is_digital_form:!procedureData["paper_form"]||false,is_smp:lotData["small_biz_only"]||false,purchase_notice_number:procedureData.registry_number,purchase_method_code:procedureData.purchase_method_code,oos_version:oosInfo["oos_version"]||1,date_second_parts_review:!!second_parts_protocol_date?second_parts_protocol_date:lotData["date_end_second_parts_review"]||"",has_subcontractor:lotData["requires_subcontracting"]||false,requires_subcontracting:lotData["requires_subcontracting"]||false},suppliers:result["suppliers"]|| {},contragent:result["contragent"]||{},price:result["price_after_negotination"]||lotData["final_price"],price_currency:procedureData["currency"],currency:procedureData.currency,positions:positions};data["contragent"]["phone"]=data["contragent"]["phone"]||null;data["contragent"]["email"]=data["contragent"]["email"]||null;data["contragent"]["legal_name"]=data["contragent"]["full_name"]||null;data["contragent"]["small_biz_only"]=lotData["small_biz_only"]||false;data["contragent"]["requires_subcontracting"]= lotData["requires_subcontracting"]||false;if(data["contragent"]["supplier_profile_id"]==null||data["contragent"]["supplier_profile_id"]==1||data["contragent"]["supplier_profile_id"]==4)data["contragent"]["type"]="L";else data["contragent"]["type"]="P";if(data["contragent"]["supplier_profile_id"]&&[4,5,6].indexOf(data["contragent"]["supplier_profile_id"])>-1)data["contragent"]["not_resident"]=true;if(procedureData["procedure_type"]==PROCEDURE_TYPE_PAPER_SINGLE_SUPPLIER&&procedureData["oos_publish_status"]< 1){data["common"]["notice_no_5_4_223"]=true;data["contract_confirming_other_docs"]=[{"actual":true,"document_date":new Date,"document_name":"\u0418\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442","document_number":"\u0411/\u041d"}]}}var contract_common_panel_cmp=Ext.getCmp(component.contract_common_panel_id);if(contract_common_panel_cmp)Ext.getCmp(component.contract_common_panel_id).fireEvent("contract_loaded",result);component.contractFilesGridPanelCmp.fireEvent("contract_loaded", result);otherDocsGrid.contract_date=data["common"]["contract_date"]||{actual:false,document_name:""};var panel3=Ext.getCmp(component.panel_ids["panel3"]);if(panel3)if(result["suppliers"]){panel3.supplier.getStore().loadData(result["suppliers"]);panel3.supplier.setValue(result.contragent.id);for(var index in result.contragent.additional_suppliers_data)component.formatContragent(result.contragent.additional_suppliers_data[index]);panel3.suppliersData=result.contragent.additional_suppliers_data}else{panel3.supplier.setVisible(false); panel3.suppliersData=null}setComponentValues(component,data,true);component.contragent_id=result.procedure_data["organizer_contragent_id"]||Main.contragent.id;component.contractRegistryPlanPositionSelectPanelCmp.fireEvent("onselect",result["purchase_plan_item"]||{});component.contractRegistryPlanPositionSelectPanelCmp.contragentId=component.contragent_id;if(!!data["common"]["oos_registry_number"]){component.contractUpdateWrapper.show();component.contractUpdateWrapper.enable()}component.procedureData= result.procedure_data;if(result.contract&&result.contract.date_customer_eds){component.contractUpdatePanel.contractDateChangedCmp.setMinValue(formatDateOnly(result.contract.date_customer_eds));component.contractSubjectInfoPanel.endExecutionDateCmp.setMinValue(formatDateOnly(result.contract.date_customer_eds))}}else echoResponseMessage(result)})}}});Application.components.ContractRegistryPublishForm.superclass.initComponent.call(this)},getInvalid:function(){var invalid=[];this.getForm().items.each(function(f){if(f.isVisible()&& !f.validate())invalid.push(f)});return invalid},formatContragent:function(data,lotData){data["phone"]=data["phone"]||null;data["email"]=data["email"]||null;data["legal_name"]=data["full_name"]||null;if(!data["type"])if(data["supplier_profile_id"]==null||data["supplier_profile_id"]==1||data["supplier_profile_id"]==4)data["type"]="L";else data["type"]="P";if(!data["not_resident"]&&data["supplier_profile_id"]&&[4,5,6].indexOf(data["supplier_profile_id"])>-1)data["not_resident"]=true},setNewConstractDate:function(contract_data){var component= this;if(contract_data&&contract_data.date_customer_eds){var new_contract_data=Ext.getCmp(component.contract_date);if(!new_contract_data.getValue())var new_contract_data=Ext.getCmp(component.contract_date).setValue(contract_data.date_customer_eds)}},validateFormValues:function(values){var valid=true;if(values["data"]&&values["data"]["subject_info"]&&values["data"]["subject_info"]["positions"]&&values["data"]["subject_info"]["positions"].length>0)Ext.iterate(values["data"]["subject_info"]["positions"], function(position,i){if(isEmpty(position["unit_okei"])&&!position["impossibleToDetermineAttr"]){alertError("\u0417\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u0435\u0434\u0438\u043d\u0438\u0446\u0443 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u0432 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430");valid=false;return false}if(isEmpty(position["unit_quantity"])&&!position["impossibleToDetermineAttr"]){alertError("\u0417\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"); valid=false;return false}if(isEmpty(position["unit_name"])){alertError("\u0417\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u043e\u0432\u0430\u0440\u043e\u0432, \u0440\u0430\u0431\u043e\u0442, \u0443\u0441\u043b\u0443\u0433 \u0432 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430");valid=false;return false}if(isEmpty(position["type_object_purchase"])){alertError("\u0417\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043f\u043e\u043b\u0435 \u0442\u0438\u043f\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0437\u0430\u043a\u0443\u043f\u043a\u0438 \u0432 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"); valid=false;return false}if(isEmpty(position["unit_price"])){alertError("\u0417\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043f\u043e\u043b\u0435 \u0446\u0435\u043d\u044b \u0437\u0430 \u0435\u0434\u0438\u043d\u0438\u0446\u0443 \u0432 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430");valid=false;return false}});if(values["data"]&&values["data"]["update"]&&values["data"]["update"]["has_good_info"]){if(values["data"]["update"]["contract_update_type"]== "M"&&isEmpty(values["data"]["update"]["contract_change_docs"])){alertError('\u0417\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c 1 \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u044b "\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e\u0431 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"'); valid=false}Ext.iterate(values["data"]["update"]["contract_change_docs"],function(position,i){if(isEmpty(position["doc_date"])){alertError('\u0417\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043f\u043e\u043b\u0435 "\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f" \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e\u0431 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430'); valid=false;return false}if(isEmpty(position["doc_date"])){alertError('\u0417\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043f\u043e\u043b\u0435 "\u0414\u0430\u0442\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430" \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e\u0431 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430');valid=false;return false}if(isEmpty(position["doc_num"])){alertError('\u0417\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043f\u043e\u043b\u0435 "\u041d\u043e\u043c\u0435\u0440 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430" \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e\u0431 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430'); valid=false;return false}})}if(!!values["data"]&&!!values["data"]["subject_info"]&&isEmpty(values["data"]["subject_info"]["start_execution_date"])){alertError('\u0417\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043f\u043e\u043b\u0435 "\u0414\u0430\u0442\u0430 \u043d\u0430\u0447\u0430\u043b\u0430 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"');valid=false;return false}if(!!values["data"]&&!!values["data"]["subject_info"]&&isEmpty(values["data"]["subject_info"]["end_execution_date"])){alertError('\u0417\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043f\u043e\u043b\u0435 "\u0414\u0430\u0442\u0430 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"'); valid=false;return false}if(!!values["data"]&&!!values["data"]["subject_info"]&&!!values["data"]["subject_info"]["long_term_contract_volumes"]){var long_term_contract_volumes_sum=0;Ext.iterate(values["data"]["subject_info"]["long_term_contract_volumes"],function(row){long_term_contract_volumes_sum+=row["summ"]});if(long_term_contract_volumes_sum.toFixed(2)!==values["data"]["subject_info"]["price"].toFixed(2)){alertError("\u0421\u0443\u043c\u043c\u0430 \u0440\u0430\u0437\u0431\u0438\u0432\u043a\u0438 \u043e\u0431 \u043e\u0431\u044a\u0435\u043c\u0430\u0445 \u043e\u043f\u043b\u0430\u0442\u044b \u0434\u043e\u043b\u0433\u043e\u0441\u0440\u043e\u0447\u043d\u043e\u0433\u043e \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0442\u044c \u0441 \u0446\u0435\u043d\u043e\u0439 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"); valid=false;return false}}return valid}});Ext.define("Application.components.ContractSignReasonPanel",{extend:"Ext.form.FormPanel",module:"com",lot_id:null,stage:null,initComponent:function(){var component=this;component.ids=initIds(["procedure_info_panel","fileFieldsetId","oos_fieldset_id"]);component.addEvents("reloadFilePanels");component.addEvents("loadProcedure");component.addEvents("goSignProtocolPage");var oos_type_store=new Ext.data.DirectStore({autoDestroy:true,autoLoad:false,root:"rows",idProperty:"code",fields:["code","name"]}); Ext.apply(this,{title:this.title?this.title:"\u0412\u0441\u043a\u0440\u044b\u0442\u0438\u0435 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u043e\u0432 \u0441 \u0437\u0430\u044f\u0432\u043a\u0430\u043c\u0438 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u0432 \u043a\u043e\u043d\u043a\u0443\u0440\u0441\u0430",fileUpload:true,border:true,frame:true,width:900,items:[{xtype:"fieldset",title:"\u041e\u0431\u0449\u0438\u0435 \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435", cls:"spaced-fieldset",defaults:{bodyStyle:"padding: 0px"},items:[{id:component.ids["procedure_info_panel"],hideTitle:true,border:false,cls:"x-panel-mc",items:[]}]},{xtype:"Application.components.OosProtocolPublicationFieldset",id:component.ids["oos_fieldset_id"],hidden:true,disabled:true,oos_type_store:oos_type_store},{xtype:"hidden",name:"lot_id",value:component.lot_id},{xtype:"hidden",name:"stage_id",value:component.stage}],buttons:[{text:"\u041f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c \u0438 \u043d\u0430\u043f\u0440\u0430\u0432\u0438\u0442\u044c", handler:function(){if(component.getForm().isValid())performSave(component,null,"goSignProtocolPage",true,false)}}],listeners:{afterrender:function(){component.fireEvent("loadProcedure");component.fireEvent("reloadFilePanels")},loadProcedure:function(){var fieldSet=Ext.getCmp(component.ids["procedure_info_panel"]);performRPCCall(RPC.Lot.load,[{lot_id:component.lot_id,with_oos_types:true}],{},function(resp){if(resp&&resp.success&&resp.procedure){fieldSet.update(getProcedureDataTemplate().apply(resp.procedure)); var oos_fieldset=Ext.getCmp(component.ids["oos_fieldset_id"]);oos_fieldset.setVisible(!!resp.procedure["send_to_oos"]);oos_fieldset.setDisabled(!resp.procedure["send_to_oos"]);if(resp["oos_types"])oos_type_store.loadData({rows:resp["oos_types"]})}else if(resp)echoResponseMessage(resp)})},reloadFilePanels:function(){component.addFilesPanel();component.doLayout();performRPCCall(RPC.Protocol.getProtocolsByLot,[{lot_id:component.lot_id,req_id:1}],{wait_delay:0,wait_text:"\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u044e\u0442\u0441\u044f \u0444\u0430\u0439\u043b\u044b \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u0432. \u041f\u043e\u0434\u043e\u0436\u0434\u0438\u0442\u0435..."}, function(result){if(result.success){if(result.protocols&&result.protocols[0])if(result.protocols[0].oos_exchage_cancelled)Ext.getCmp(component.ids["oos_fieldset_id"]).setChecked(true);else{if(result.protocols[0].oos_type_id)setComponentValues(component,{oos_type_id:result.protocols[0].oos_type_id});if(result.protocols[0].date_happened)setComponentValues(component,{date_happened:result.protocols[0].date_happened});if(result.protocols[0].place_happened)setComponentValues(component,{place_happened:result.protocols[0].place_happened}); if(result.protocols[0].date_protocol_signed)setComponentValues(component,{date_protocol_signed:result.protocols[0].date_protocol_signed})}loadFilesIntoFilePanels(result.protocols,{deleteHandler:component.deleteHandler})}else echoResponseMessage(result)})},goSignProtocolPage:function(resp){var sign_url=this.module+"/protocol/signprotocol/lot/"+component.lot_id+"/stage/"+component.stage;if(component.act&&component.act=="decline")sign_url+="/act/"+component.act;if(resp.result.success&&component.stage== 2&&resp.result.showAllButton)sign_url+="/showall/1";redirect_to(sign_url)}},addFilesPanel:function(){var component=this;component.add({xtype:"Application.components.FilesPanel",id:component.ids["fileFieldsetId"],border:false,file_panels:[{name:"\u041f\u0440\u043e\u0442\u043e\u043a\u043e\u043b",xtype:"fieldset",descr:'

\u0410\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u043c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0444\u0430\u0439\u043b \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430. \u0415\u0441\u043b\u0438 \u0432\u0430\u0448 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u043c\u043d\u043e\u0433\u043e\u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u0439, \u0442\u043e \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u0439\u0442\u0435 \u0441\u043a\u0430\u043d\u044b \u0432 \u0430\u0440\u0445\u0438\u0432\u0435, \u043b\u0438\u0431\u043e \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 Word.

', withDescr:false,req_id:1}]})}});Application.components.ContractSignReasonPanel.superclass.initComponent.call(this);this.form.api=component.getFormApi();this.form.waitMsgTarget=true},getFormApi:function(){return{submit:RPC.Contract.saveSignReason}}});Ext.define("Application.components.ContractSubjectInfoLongTermsGrid",{extend:"Ext.Panel",exchangeRate:null,currency:null,rubCurrency:810,validSum:null,showButtons:false,setValues:function(v){while(this.items.getCount()>2)this.remove(1);if(v)for(var i=0;i=0;i--){var p=this.getPanel(subcomponents[i]); if(p&&!p.isValid()){this.activeError=p.getActiveError();valid=false;break}}if(valid)this.activeError=false;return valid},getPanel:function(type){var p=this.find("name",type);return p&&p[0]?p[0]:null}}},addItem:function(v,batch){var me=this;var i=Ext.apply({},me.getTemplate());i.items=[];for(var k=0;k0&&this.getValue()!=810)},select:function(combo,item){component.exchangeRateCmp.setVisible(item&&item.get("id")!==810);component.priceRubCmp.setVisible(this.getValue()!=810);component.contractSubjectInfoLongTermsGrid.currency= this.getValue();component.contractExecutionPeriodChanged()}}}]},{xtype:"Application.components.priceField",allowNegative:false,name:"exchange_rate",ref:"exchangeRateCmp",fieldLabel:"\u041a\u0443\u0440\u0441 \u0432\u0430\u043b\u044e\u0442\u044b"+REQUIRED_FIELD,tooltipTpl:"{name}",allowBlank:true,minValue:.01,width:180,plugins:[Ext.ux.plugins.ToolTip],qtipConfig:{html:"\u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0438 \u0437\u0430\u043a\u0443\u043f\u043a\u0438 \u0432 \u0432\u0430\u043b\u044e\u0442\u0435, \u043e\u0442\u043b\u0438\u0447\u043d\u043e\u0439 \u043e\u0442 \u0440\u0443\u0431\u043b\u044f.", autoHide:false,applyTipTo:"label"},listeners:{change:function(){component.contractSubjectInfoLongTermsGrid.exchangeRate=component.currencyCmp.getValue()===810?1:component.exchangeRateCmp.getValue();component.contractSubjectInfoLongTermsGrid.currency=component.currencyCmp.getValue();component.contractSubjectInfoLongTermsGrid.update();if(isEmpty(component.priceCmp.getValue())||isEmpty(component.exchangeRateCmp.getValue()))component.priceRubCmp.setValue("");else component.priceRubCmp.setValue(Ext.util.Format.formatPrice(component.priceCmp.getValue()* component.exchangeRateCmp.getValue()))}}},{xtype:"displayfield",name:"priceRub",readOnly:true,hidden:true,ref:"priceRubCmp",width:180,fieldLabel:"\u0426\u0435\u043d\u0430 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430, \u0440\u0443\u0431."},{fieldLabel:"\u0414\u0430\u0442\u0430 \u043d\u0430\u0447\u0430\u043b\u0430 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"+REQUIRED_FIELD,xtype:"Application.components.dateField",format:"d.m.Y",allowBlank:false, anchor:null,ref:"startExecutionDateCmp",name:"start_execution_date",width:200,listeners:{change:component.contractExecutionPeriodChanged.createDelegate(this)}},{fieldLabel:"\u0423\u0441\u043b\u043e\u0432\u0438\u0435 \u043d\u0430\u0447\u0430\u043b\u0430 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430",xtype:"textfield",anchor:"100%",name:"start_execution_term"},{fieldLabel:"\u0414\u0430\u0442\u0430 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"+ REQUIRED_FIELD,xtype:"Application.components.dateField",format:"d.m.Y",anchor:null,allowBlank:false,name:"end_execution_date",ref:"endExecutionDateCmp",width:200,listeners:{change:component.contractExecutionPeriodChanged.createDelegate(this)}},{fieldLabel:"\u0423\u0441\u043b\u043e\u0432\u0438\u0435 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430",xtype:"textfield",anchor:"100%",name:"end_execution_term"}, {xtype:"fieldset",title:"\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e\u0431 \u043e\u0431\u044a\u0435\u043c\u0430\u0445 \u043e\u043f\u043b\u0430\u0442\u044b \u0434\u043e\u043b\u0433\u043e\u0441\u0440\u043e\u0447\u043d\u043e\u0433\u043e \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430",hidden:true,ref:"contractSubjectInfoLongTermsFieldset",items:[{xtype:"Application.components.ContractSubjectInfoLongTermsGrid",name:"long_term_contract_volumes",ref:"../contractSubjectInfoLongTermsGrid", autoHeight:true}]},{xtype:"fieldset",title:"\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0442\u043e\u0432\u0430\u0440\u0430\u0445, \u0440\u0430\u0431\u043e\u0442\u0430\u0445, \u0443\u0441\u043b\u0443\u0433\u0430\u0445",items:[{xtype:"Application.components.LotUnitsGrid",contract_id:component.contract_id,ref:"../posGridCmp",name:"positions",autoHeight:true}]}]});Application.components.ContractSubjectInfoPanel.superclass.initComponent.call(this)}});Ext.define("Application.components.ContractTerminatePanel",{extend:"Ext.Panel",layout:"form",contractPositions:null,currencyStore:null,countriesStore:null,parentCmp:null,initComponent:function(){var me=this;Ext.apply(me,{items:[{xtype:"combo",fieldLabel:"\u041e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0440\u0430\u0441\u0442\u043e\u0440\u0436\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"+REQUIRED_FIELD,allowBlank:false,name:"base_cancel_code",valueField:"id",displayField:"text", mode:"local",anchor:"100%",store:new Ext.data.JsonStore({fields:["id","text"],data:CONTRACT_CANCEL_BASES}),listeners:{select:function(cmp,value){},beforeselect:function(cmp,value){}}},{xtype:"Application.components.dateField",name:"cancel_date",format:"d.m.Y",fieldLabel:"\u0414\u0430\u0442\u0430 \u0440\u0430\u0441\u0442\u043e\u0440\u0436\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"+REQUIRED_FIELD,allowBlank:false,width:200},{xtype:"combo",fieldLabel:"\u041d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430-\u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u044f"+ REQUIRED_FIELD,allowBlank:false,name:"base_cancel_doc_code",valueField:"id",displayField:"text",mode:"local",anchor:"100%",store:new Ext.data.JsonStore({fields:["id","text"],data:CONTRACT_CANCEL_BASES_DOC}),listeners:{select:function(cmp,value){},beforeselect:function(cmp,value){}}},{xtype:"textfield",name:"base_cancel_doc_num",fieldLabel:"\u041d\u043e\u043c\u0435\u0440 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430-\u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u044f"},{xtype:"Application.components.dateField", name:"cancel_doc_date",format:"d.m.Y",fieldLabel:"\u0414\u0430\u0442\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430-\u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u044f"+REQUIRED_FIELD,allowBlank:false,width:200}]});Application.components.ContractTerminatePanel.superclass.initComponent.call(this)}});Ext.define("Application.components.ContractTerminationPublishForm",{extend:"Ext.panel.Panel",frame:true,border:false,bodyCssClass:"subpanel",message_type:null,contract_id:null,oos_contract_id:null,oos_version:null,data:{lastPublishedContract:null},currencyStore:null,countriesStore:null,initComponent:function(){var me=this;me.addEvents("submitForm");Ext.apply(me,{items:[{xtype:"Application.components.ContractInfoPanel",labelWidth:300,ref:"infoPanel"},{xtype:"Application.components.FormFieldsetContainer", ref:"cancelationInfoPanel",name:"cancelationInfo",title:"\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e\u0431 \u0440\u0430\u0441\u0442\u043e\u0440\u0436\u0435\u043d\u0438\u0438 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430",items:[{xtype:"Application.components.ContractTerminatePanel",labelWidth:300,parentCmp:me,ref:"../cancelationGrid"}]},{xtype:"Application.components.FormFieldsetContainer",ref:"contractExecutionPenaltiesPanel",name:"penaltiesInfo",title:"\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u043d\u0435\u0443\u0441\u0442\u043e\u0439\u043a\u0430\u0445", items:[{xtype:"Application.components.ContractExecutionPenalties",labelWidth:300,defaults:{anchor:"100%"},ref:"../cancelationPenalies"}]},{xtype:"Application.components.FormFieldsetContainer",title:"\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b"+REQUIRED_FIELD,name:"files",ref:"docsPanel",items:[{html:"\u0414\u043b\u044f \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0439\u0442\u0435 \u0438\u0445 \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u043e\u0440\u043c\u044b \u043d\u0438\u0436\u0435. "+ ACCEPTED_FILES+".",cls:"spaced-bottom-shallow"},{xtype:"Application.components.multiuploadPanel",uploadHandler:RPC.Contract.addOosContractFile,deleteHandler:RPC.Contract.removeOosContractFile,name:"file",simultaneousUpload:true,autoUpload:true,requiredDescr:false,requiredMark:true,listeners:{beforeupload:function(cmp){cmp.uploadParams={message_type:me.message_type,contract_id:me.contract_id,oos_contract_id:me.oos_contract_id||null}},uploadcomplete:function(result,action){if(!!result.success)me.oos_contract_id= result["oos_contract_id"]}}}]}],buttons:[{text:"\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c",handler:function(){me.fireEvent("submitForm",false)}},{text:"\u041e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c",handler:function(){me.fireEvent("submitForm",true)}},{text:"\u041d\u0430\u0437\u0430\u0434",handler:function(){history.back(1)}}],listeners:{afterrender:me.onAfterrender,submitForm:me.onSubmitForm}});Application.components.ContractTerminationPublishForm.superclass.initComponent.call(this)}, getValues:function(){var me=this;var values={};collectComponentValues(me,values);return values},validateForm:function(formValues){if(isEmpty(formValues["files"])||isEmpty(formValues["files"]["file"])){alertError("\u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u043f\u0440\u0438\u043a\u0440\u0435\u043f\u0438\u0442\u0435 \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u043e\u0434\u0438\u043d \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u0439 \u043e\u0431 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"); return false}return true},onSubmitForm:function(sent_to_oos){var me=this;sent_to_oos=sent_to_oos||false;if(!me.validateForm(me.getValues()))return false;var values={id:me["oos_contract_id"],sent_to_oos:!!sent_to_oos,contract_id:me["contract_id"],version:me["oos_version"],message_type:me["message_type"],data:me.getValues()};if(sent_to_oos&&isEmpty(values["data"]["cancelationInfo"]["base_cancel_code"])){alertError("\u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u0443\u043a\u0430\u0436\u0438\u0442\u0435 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0440\u0430\u0441\u0442\u043e\u0440\u0436\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"); return false}if(sent_to_oos&&isEmpty(values["data"]["cancelationInfo"]["cancel_date"])){alertError("\u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u0443\u043a\u0430\u0436\u0438\u0442\u0435 \u0434\u0430\u0442\u0443 \u0440\u0430\u0441\u0442\u043e\u0440\u0436\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430");return false}if(sent_to_oos&&isEmpty(values["data"]["cancelationInfo"]["base_cancel_doc_code"])){alertError("\u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u0443\u043a\u0430\u0436\u0438\u0442\u0435 \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430-\u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u044f"); return false}if(sent_to_oos&&isEmpty(values["data"]["cancelationInfo"]["cancel_doc_date"])){alertError("\u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u0443\u043a\u0430\u0436\u0438\u0442\u0435 \u0434\u0430\u0442\u0443 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430-\u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u044f");return false}performRPCCall(RPC.Contract.oosqueue,[values],{wait_delay:0,wait_text:sent_to_oos?"\u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f c\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e\u0431 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u043d\u0430 zakupki.gov.ru": "\u0414\u0430\u043d\u043d\u044b\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442\u0441\u044f"},function(result){echoResponseMessage(result);if(!!result)me.oos_contract_id=result.id})},updateInfoPanel:function(){var me=this;if(isEmpty(me.data.lastPublishedContract))return;me.infoPanel.setValues({oos_registry_number:me.data.lastPublishedContract["oos_registry_number"]||"",contract_date:Ext.util.Format.dateRenderer("d.m.Y")(me.data.lastPublishedContract["data"]["common"]["contract_date"]), subject:me.data.lastPublishedContract["data"]["common"]["subject"]||"",oos_version:me.oos_version})},loadAcceptanceInfo:function(){var me=this;if(!isEmpty(me.data.contract_data))setComponentValues(me,me.data.contract_data)},onAfterrender:function(){var me=this;performRPCCall(RPC.Contract.oosdata,[{contract_id:me.contract_id,message_type:me.message_type}],{wait_delay:0,wait_text:"\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u044e\u0442\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u0435 "+t("\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430")+ ". \u041f\u043e\u0434\u043e\u0436\u0434\u0438\u0442\u0435..."},function(result){me.oos_contract_id=result["oos_contract_id"];me.oos_version=result["oos_info"]["version"]||1;me.data.lastPublishedContract=result["last_published_contract"];me.data.contract_data=result["contract_data"];if(!me.data.contract_data["acceptanceInfo"])me.data.contract_data["acceptanceInfo"]=[];me.data.contract_data["acceptanceInfo"]["oos_version"]=me.oos_version;me.updateInfoPanel();me.loadAcceptanceInfo()})}});Ext.define("Application.components.ContractTypedFilesPanel",{extend:"Ext.form.FieldSet",title:"\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b",files:[],lotInfo:{},tabIndex:null,fileTypeId:0,signStrategy:[],currentCustomer:null,currentSupplier:null,currentOrganizer:null,uploadContragentType:null,locked:false,hiddenEmpty:false,showVersions:true,signRpcMethod:null,fileHashRpcMethod:null,enableDeleteLastVersion:false,showInfopanel:true,actualMode:null,uploadButtonTitle:"\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c", signButtonTitle:"\u041f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c",onlyOneSignedFile:false,checkSignPossibility:false,header:false,viewCancelled:false,preSigningMethod:null,addHeader:false,signButtonId:Ext.id(),renderHeaderPanel:function(){return this.header||this.addHeader||false},renderFilesPanel:function(){var me=this;return{xtype:"panel",border:false,frame:false,title:false,style:"margin-bottom: 10px;",ref:"filesPanelWrapper",items:[me.renderFilesCmp()]}},renderFilesCmp:function(){var me= this;return{xtype:"ux.contractlist",hide_date_added_col:true,hide_last_version_col:!me.showVersions,parentComponent:me,enableDelete:me.isFileDeleteEnabled()&&(isAdmin()||me.isUploadableContragent()),enableDeleteLastVersion:me.enableDeleteLastVersion,files:me.isUploadableContragent()?me.getFiles():me.getVisibleFiles()}},getFiles:function(){return this.files},isFileDeleteEnabled:function(){if(!this.isSignedByContragentType("supplier")&&!this.isSignedByContragentType("customer"))return true;return this.isUploadable()&& isEmpty(this.signStrategy)},countFiles:function(){return!isEmpty(this.files)?this.files.length:0},countActualFiles:function(){return this.getActualFiles().length},isLastFileSigned:function(){var file=this.files[0];if(!file)return false;return!!file["customerSigned"]||!!file["supplierSigned"]},isLastFileSignFinished:function(){var me=this;var actualFiles=me.getActualFiles();var lastFile=actualFiles[0]||false;if(!lastFile||!lastFile["customerSigned"]&&!lastFile["supplierSigned"])return false;var signed= true;Ext.iterate(me.signStrategy,function(whoSigns){if(!lastFile[whoSigns+"Signed"])signed=false});return signed},getActualFiles:function(){return this.getActualFilesByArray(this.files)},getVisibleFiles:function(){return this.getVisibleFilesByArray(this.files)},countVisibleFiles:function(){return this.getVisibleFiles().length},getVisibleFilesByArray:function(filesArray){var result=[];var me=this;var filesArrayCount=filesArray.length;Ext.iterate(filesArray,function(file){if(me.isActualSupervisor()|| isEmpty(me.signStrategy)||!!file["customerSigned"]||!!file["supplierSigned"]||me.isUploadableContragent())result.push(file);else if(me.signStrategy[0]===me.uploadContragentType&&me.actualMode&&me.actualMode.toLowerCase()===me.uploadContragentType)result.push(file);else if(!!file.is_last_version&&me.signStrategy[0]==="customer"&&me.needSignByCustomer()&&me.isActualCustomer())result.push(file);else if(!!file.is_last_version&&me.signStrategy[0]==="supplier"&&me.needSignBySupplier()&&me.isActualSupplier())result.push(file); else if(!file.is_last_version&&(!!me.viewCancelled||!!me.getActualAdditionalSupplierInfo())&&filesArrayCount>0&&me.actualMode!=="View")result.push(file)});return result},getActualFilesByArray:function(filesArray){var result=[];Ext.iterate(filesArray,function(file){if(!!file["is_last_version"])result.push(file)});return result},isActualCustomer:function(){return Main.contragent.id==this.currentCustomer},isActualOrganizer:function(){return Main.contragent.id==this.currentOrganizer},isActualSupervisor:function(){return!!isAdmin()}, isActualSupplier:function(){var isActual=false;if(Main.contragent.id==this.currentSupplier)isActual=true;if(this.isAdditionalSuppliers()){var additionalSupplier=this.getActualAdditionalSupplierInfo();if(additionalSupplier["supplier_id"]===Main.contragent.id)isActual=true}return isActual},isSignableContragent:function(){var me=this;if(!this.countActualFiles())return false;if(!!me.locked)return false;if(!!isAdmin())return false;var stepSignable=false;Ext.iterate(this.signStrategy,function(signStep){if(me["isSignedBy"+ capitalizeFirstLetter(signStep)]())return true;if(signStep==="supplier"&&me.isActualSupplier()){stepSignable=true;return false}if(signStep==="customer"&&me.isActualCustomer()){stepSignable=true;return false}return false});if(me.isAdditionalSuppliers()){var actualContract=me.getLastVersionFile();var actualAdditionalSupplier=me.getActualAdditionalSupplierInfo();if(!isEmpty(actualAdditionalSupplier))return actualContract["date_supplier_eds"]&&isEmpty(actualContract["additional_suppliers_data"][actualAdditionalSupplier["supplier_id"]]["signature"]); if(me.isActualSupplier()&&!!actualContract.mainSupplierSigned)return false}return stepSignable},isOnlyOneSigned:function(){var me=this;if(!me.onlyOneSignedFile)return false;return me.isLastFileSignFinished()},isUploadableContragent:function(){var me=this;if(me.locked)return false;if((me.isActualCustomer()||me.isActualOrganizer())&&["both","customer"].indexOf(me.uploadContragentType)>-1)return!me.isSignedBySupplier()&&!me.isOnlyOneSigned();if(me.isActualSupplier()&&["both","supplier"].indexOf(me.uploadContragentType)> -1){if(!!me.getActualAdditionalSupplierInfo())return false;return!me.isSignedByCustomer()&&!me.isOnlyOneSigned()}return false},isUploadable:function(){var me=this;if(me.locked)return false;if(me.actualMode==="View")return false;if(me.uploadContragentType=="supplier"&&Main.contragent.id==me.currentSupplier)return true;if(me.uploadContragentType=="customer"&&Main.contragent.id==me.currentCustomer)return true;return false},renderUploadPanel:function(){return{html:"upload here"}},isSignedByContragentType:function(contragentType){var me= this;var result=false;if(me.countFiles())Ext.iterate(me.getFiles(),function(file,i){if((!!file["is_last_version"]||i==0)&&!!file[contragentType+"Signed"]){result=true;return false}});return result},isSignedByCustomer:function(){return this.isSignedByContragentType("customer")},isSignedByAdditionalSuppliers:function(){var signed=true;var currentContract=this.getLastVersionFile();Ext.iterate(currentContract["additional_suppliers_data"],function(i,additional){if(isEmpty(additional["signature"]))signed= false});return signed},isSignedBySupplier:function(){var signed=this.isSignedByContragentType("supplier");if(signed&&this.isAdditionalSuppliers()&&!this.isSignedByAdditionalSuppliers())signed=false;return signed},needSignByCustomer:function(){var me=this;if(!this.countActualFiles())return false;if(this.locked)return false;var result=false;Ext.iterate(me.signStrategy,function(whoSigns){if(whoSigns==="supplier")return me.isSignedBySupplier();if(whoSigns==="customer"){result=!me.isSignedByCustomer(); return false}});return result},needSignBySupplier:function(){var me=this;if(!this.countActualFiles())return false;if(this.locked)return false;var result=false;Ext.iterate(me.signStrategy,function(whoSigns){if(whoSigns==="customer")return me.isSignedByCustomer();if(whoSigns==="supplier"){result=!me.isSignedBySupplier();return false}});return result},renderInfoPanel:function(info_text,buttons){if(buttons)return{xtype:"fieldset",layout:"column",style:"padding: 10px 5px",items:[{xtype:"panel",columnWidth:.6, html:'
'+info_text+"
"},{xtype:"panel",columnWidth:.4,items:buttons}]};return{xtype:"fieldset",layout:"column",style:"padding: 5px",items:[{xtype:"panel",columnWidth:1,html:'
'+info_text+"
"}]}},renderSignatureInfoPanel:function(actualFiles,mode,baseTitle){var title="";var actualFile=actualFiles[0];var fileSignatureLink=null;var buttons= null;if(mode=="supplier"){title+=baseTitle||"\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u043e\u043c";title+=", "+Ext.util.Format.localDateText(parseDate(actualFile.date_supplier_eds));fileSignatureLink=actualFile.link+"/extract/2"}else if(mode=="customer"){title+=baseTitle||"\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u043e\u043c"; title+=", "+Ext.util.Format.localDateText(parseDate(actualFile.date_customer_eds));fileSignatureLink=actualFile.link+"/extract/1"}if(fileSignatureLink){title+=", "+'\u0421\u043a\u0430\u0447\u0430\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 PKCS#'; buttons=[{xtype:"button",text:"\u0420\u0435\u043a\u0432\u0438\u0437\u0438\u0442\u044b "+t("\u042d\u0426\u041f"),handler:function(){Application.models.Contract.showEdsInfo(Ext.util.Format.nl2br(actualFile["signatures"][mode]))}}]}return this.renderInfoPanel(title,buttons)},renderStatusPanelItems:function(){var panels=[];var me=this;var possibleNotSigning=me.checkSignPossibility&&me.signStrategy.indexOf("supplier")>-1&&(me.currentSupplier!==me.lotInfo["contract_supplier_id"]&&!in_array(me.currentSupplier, me.lotInfo["selected_contract_supplier_ids"]||[]));if((me.countActualFiles()||me.isLastFileSigned())&&!!me.countVisibleFiles()){if(me.isSignedBySupplier())panels.push(me.renderSignatureInfoPanel(me.getFiles(),"supplier"));if(me.isSignedByCustomer())panels.push(me.renderSignatureInfoPanel(me.getFiles(),"customer"));if(me.needSignByCustomer()&&me.countVisibleFiles()>0)panels.push(me.renderInfoPanel('\u041e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u0430')); if(me.needSignBySupplier()&&me.countVisibleFiles()>0)panels.push(me.renderInfoPanel('\u041e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044f'))}else if(!!me.showInfopanel)if(me.uploadContragentType=="customer"&&Main.contragent.id!=me.currentCustomer&& !possibleNotSigning)panels.push(me.renderInfoPanel('\u041e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u043e\u043c'));else if(me.uploadContragentType=="supplier"&&Main.contragent.id!=me.currentSupplier)panels.push(me.renderInfoPanel('\u041e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u043e\u043c')); else{if(me.locked&&!possibleNotSigning)panels.push(me.renderInfoPanel('\u041f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043d\u0435 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043b\u043e\u0441\u044c'))}else if(!me.isUploadableContragent())panels.push(me.renderInfoPanel('\u041e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430')); if(possibleNotSigning&&me.getVisibleFiles().length<1)panels.push(me.renderInfoPanel('\u0414\u043e\u0433\u043e\u0432\u043e\u0440 \u0441 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u043c \u043d\u0435 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f'));return panels},getSubSuppliersSignPanelTitle:function(fileTypeId){var typeTitle="";switch(fileTypeId){case CONTRACT_FILE_TYPE_ADDITIONAL_AGREEMENT:typeTitle= "\u0434\u043e\u043f. \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f";break;case CONTRACT_FILE_TYPE_DISCREPANCY:typeTitle="\u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 \u0440\u0430\u0437\u043d\u043e\u0433\u043b\u0430\u0441\u0438\u0439";break;case CONTRACT_FILE_TYPE_GUARANTEE:typeTitle="\u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430";break;default:typeTitle= "\u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430";break}return"\u0421\u0442\u0430\u0442\u0443\u0441 \u043f\u043e\u0434\u043f\u0438\u0441\u0438 "+typeTitle+" \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044f\u043c\u0438"},getSubSuppliersSignPanel:function(data,title,contract_id){var component=this;var data_json=[];Ext.iterate(data,function(i,item){item["id"]=i;data_json.push(item)});var store=new Ext.data.JsonStore({autoDestroy:true,fields:["id","supplier_full_name","status",{name:"date_signed", type:"date"}]});store.loadData(data_json);var cmp={xtype:"fieldset",title:title||component.getSubSuppliersSignPanelTitle(component.fileTypeId),items:[{xtype:"grid",columns:[{header:"\u0417\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044c",flex:1,sortable:true,dataIndex:"supplier_full_name"},{header:"\u0421\u0442\u0430\u0442\u0443\u0441",width:35,renderer:function(value,metaData,record){return record.get("date_signed")?"\u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043e":"\u043e\u0436\u0438\u0434\u0430\u0435\u0442 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u044f"}}, {header:"\u0414\u0430\u0442\u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u044f",width:45,dataIndex:"date_signed",renderer:Ext.util.Format.dateRenderer("d.m.Y")},{header:"\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u0438",xtype:"textactioncolumn",actionsSeparator:" ",items:[{tooltip:"\u0421\u043a\u0430\u0447\u0430\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 PKCS#7",icon:"/ico/sign.png",handler:function(grid,rowIndex,colIndex, item,e){var record=grid.getStore().getAt(rowIndex);var params={id:contract_id,supplier:record["id"]};performAjaxRPCCall("contract/getSignature",params,{download:true,wait_disable:true},echoResponseMessage)},isHidden:function(v,meta,rec){return!rec.get("date_signed")}},{tooltip:"\u0420\u0435\u043a\u0432\u0438\u0437\u0438\u0442\u044b \u043f\u043e\u0434\u043f\u0438\u0441\u0438",icon:"/ico/appl_dover.png",handler:function(grid,rowIndex,colIndex,item,e){var record=grid.getStore().getAt(rowIndex);var params= {id:contract_id,supplier:record["id"]};performRPCCall(RPC.Contract.getSignatureInfo,[params],component.waitParams,function(resp){if(resp.success)Application.models.Contract.showEdsInfo(Ext.util.Format.nl2br(resp.message));else echoResponseMessage(resp)})},isHidden:function(v,meta,rec){return!rec.get("date_signed")}}],width:20,sortable:false}],autoHeight:true,store:store,viewConfig:{forceFit:true}}]};return cmp},renderStatusPanel:function(){var me=this;return{xtype:"panel",ref:"statusPanelWrapper", items:[me.renderStatusPanelItems()]}},renderSignatureText:function(){var signDate=Ext.util.Format.localDateRenderer(new Date).replace(" ","");return"\u041d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u043c \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u0435\u043c \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 \u0440\u0430\u0437\u043d\u043e\u0433\u043b\u0430\u0441\u0438\u0439 \u043f\u043e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435 "+ component.lotInfo.registry_number+', \u043b\u043e\u0442 "'+component.lotInfo.title+'". '+"\u0417\u0430\u043a\u0430\u0437\u0447\u0438\u043a: "+component.customers[0].full_name+". "+"\u0417\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044c: "+Main.user.full_name+". "+" \u0414\u0430\u0442\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438: "+signDate},getRpcWaitParams:function(){return{"wait_text":"\u041f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c..."}},getSignSupplierId:function(){if(this.isActualSupplier())return Main.contragent.id; return this.currentSupplier},loadContractHash:function(document_type,algoOid,successCallback,failureCallback){var me=this;performRPCCall(me.fileHashRpcMethod,[{lot_id:me.lotInfo.id,algo:algoOid,currentCustomer:me.currentCustomer,currentSupplier:me.currentSupplier,signSupplier:me.getSignSupplierId(),type_id:document_type,tab_index:me.tabIndex}],me.getRpcWaitParams(),function(resp){if(resp["hash"])return successCallback(resp["hash"]);return failureCallback("\u041e\u0448\u0438\u0431\u043a\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 \u0434\u043b\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u0438: "+ resp.message||"")})},getSignParams:function(){var me=this;return{lot_id:me.lotInfo.id,contract_id:me.getActualFiles()[0].id,currentCustomer:me.currentCustomer,currentSupplier:me.currentSupplier,signSupplier:me.getSignSupplierId(),type:me.actualMode,type_id:me.fileTypeId,tab_index:me.tabIndex}},disableSignButton:function(){if(Ext.getCmp(this.signButtonId))Ext.getCmp(this.signButtonId).disable()},enableSignButton:function(){if(Ext.getCmp(this.signButtonId))Ext.getCmp(this.signButtonId).enable()},renderSignButton:function(){var me= this;return{text:me.signButtonTitle,id:me.signButtonId,handler:function(){if(!!me.preSigningMethod&&!me.preSigningMethod.call(me))return false;Ext.getCmp(me.signButtonId).disable();if(!!Main.user.simple_signing){var parameters={"lot_id":me.lotInfo.id,"currentCustomer":me.currentCustomer,"currentSupplier":me.currentSupplier,"signSupplier":me.getSignSupplierId(),"type_id":me.fileTypeId,"tab_index":me.tabIndex};var winItems=[];for(var paramName in parameters)winItems.push({xtype:"hidden",name:paramName, value:parameters[paramName]});var win=new Application.components.promptWindow({title:"\u041f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430",cmpType:"Application.components.SignatureForm",parentCmp:component,modal:true,cmpParams:{api:RPC.Contract.signAdditionalAgreement,signatureText:me.renderSignatureText(),signatureTextHeight:250,useFormHandler:false,items:winItems,success_fn:function(resp){Ext.getCmp(me.signButtonId).enable();component.button_signed_disagreement= true;component.fireEvent("reload",component.filePanelId);win.close()}}});win.show()}else CryptoApi.setSigningCertificate(function(certificate,algoOid){me.loadContractHash(me.fileTypeId,algoOid,function(hash){CryptoApi.signFileByHash({hash:hash},function(signedMessage){var params=Ext.apply(me.getSignParams(),{signature:signedMessage,algo:algoOid});performRPCCall(me.signRpcMethod,[params],[],function(resp){Ext.getCmp(me.signButtonId).enable();if(resp.success)me.fireEvent("signed",resp);else alertError(resp.message)})}, function(err){alertError("\u041e\u0448\u0438\u0431\u043a\u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u044f: "+err)})},function(message){alertError(message)})})}}},renderUploadButton:function(){var me=this;return{text:me.uploadButtonTitle,disabled:false,handler:function(){var window=new Ext.Window({autoHeight:true,width:600,closeAction:"close",modal:true,title:"\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430",items:[{width:"100%", border:false,autoheight:true,frame:true,params:{"id":me.lotInfo.id,"currentCustomer":me.currentCustomer,"currentSupplier":me.currentSupplier,"type_id":me.fileTypeId,"tabIndex":me.tabIndex},fileUpload:true,xtype:"Application.components.uploadContractForm",filePanelId:"upload-draft-form",preventDuplicates:true,labelWidth:150,listeners:{cancelled:function(){window.close()},uploadComplete:function(response){window.close();me.fireEvent("uploaded",response.result)}}}]});window.show()}}},renderButtons:function(){var me= this;var buttons=[];if(me.isUploadableContragent())buttons.push(me.renderUploadButton());if(me.isSignableContragent())buttons.push(me.renderSignButton());return buttons},renderButtonsPanel:function(){var me=this;return{xtype:"panel",ref:"buttonsPanelWrapper",fbar:new Ext.Toolbar({items:me.renderButtons()}),buttonAlign:"center"}},renderAdditionalPanels:function(){return{}},isVisible:function(){var me=this;if(!me.hiddenEmpty)return true;if(!me.countVisibleFiles()&&!me.isUploadableContragent())return false; return true},renderDebugPanel:function(){var me=this;return{xtype:"fieldset",collapsible:true,collapsed:true,title:"debug",items:[{html:"isUploadableContragent: "+me.isUploadableContragent()+"
"+"isSignableContragent: "+me.isSignableContragent()+"
"+"actualMode: "+me.actualMode+"
"+"isActualSupplier: "+me.isActualSupplier()+"
"+"isActualCustomer: "+me.isActualCustomer()+"
"+"signStrategy: "+me.signStrategy+"
"+"uploadContragentType: "+me.uploadContragentType+"
"+"isSignedBySupplier: "+ me.isSignedBySupplier()+"
"+"isSignedByCustomer: "+me.isSignedByCustomer()+"
"+"isOnlyOneSigned: "+me.isOnlyOneSigned()+"
"+"isVisible: "+me.isVisible()+"
"+"hiddenEmpty: "+me.hiddenEmpty+"
"+"locked: "+me.locked+"
"+"countActualFiles: "+me.countActualFiles()+"
"+"countVisibleFiles: "+me.countVisibleFiles()+"
"+"files: "+me.files.length+"
"+"viewCancelled: "+me.viewCancelled+"
"+"isAdditionalSuppliers: "+me.isAdditionalSuppliers()+"
"+"getActualAdditionalSupplierInfo: "+ me.getActualAdditionalSupplierInfo()}]}},getSupplierInfo:function(supplier_id){var me=this;var result={};Ext.each(me.suppliers,function(supplier){if(supplier["id"]==supplier_id)result=supplier});return result},getLastVersionFile:function(){var resultFile;Ext.iterate(this.files,function(file){if(!!file["is_last_version"])resultFile=file});return resultFile},getActualSupplierInfo:function(){return this.getSupplierInfo(this.currentSupplier)},getActualAdditionalSupplierInfo:function(){var info=false; var currentSupplier=this.getLastVersionFile();if(!currentSupplier)return false;if(!isEmpty(currentSupplier["additional_suppliers_data"]))Ext.iterate(currentSupplier["additional_suppliers_data"],function(i,item){if(item.supplier_id===Main.contragent.id)info=item});return info},isAdditionalSuppliers:function(){var me=this;var currentContract=me.getLastVersionFile();return currentContract&&!isEmpty(currentContract["additional_suppliers_data"])},renderSubSuppliersPanel:function(){var me=this;var currentContract= me.getLastVersionFile();if(!currentContract||!me.isAdditionalSuppliers())return{};if(me.signStrategy[0]==="supplier"&&me.signStrategy.length===1&&!me.isSignedBySupplier()&&!me.isActualSupplier())return{};var main_supplier=me.getActualSupplierInfo();var suppliers={0:{supplier_full_name:""+main_supplier["full_name"]+"",supplier_short_name:main_supplier["short_name"],date_signed:parseDate(currentContract["date_supplier_eds"]),status:currentContract["date_supplier_eds"]?1:0}};Ext.apply(suppliers, currentContract["additional_suppliers_data"]);return me.getSubSuppliersSignPanel(suppliers,false,currentContract["id"])},initComponent:function(){var me=this;me.signButtonId=Ext.id();me.addEvents("reload","signed","uploaded");Ext.apply(me,{hidden:!!me.hidden||!me.isVisible(),items:[me.renderHeaderPanel(),me.renderFilesPanel(),me.renderStatusPanel(),me.renderButtonsPanel(),me.renderSubSuppliersPanel(),me.renderAdditionalPanels()],listeners:{reload:function(){Main.app.run()},uploaded:function(response){if(response.success&& response.files&&me.filesPanelWrapper){me.files=response.files;me.filesPanelWrapper.removeAll();me.filesPanelWrapper.add(me.renderFilesCmp());me.filesPanelWrapper.doLayout();me.statusPanelWrapper.removeAll();me.statusPanelWrapper.add(me.renderStatusPanelItems());me.statusPanelWrapper.doLayout();me.buttonsPanelWrapper.fbar.removeAll();me.buttonsPanelWrapper.fbar.add(me.renderButtons());me.buttonsPanelWrapper.fbar.doLayout(true)}}}});Application.components.ContractTypedFilesPanel.superclass.initComponent.call(this)}, listeners:{signed:function(resp){if(!!resp.success){Main.app.run();echoResponseMessage(resp,function(){})}else Main.app.run()},uploaded:function(resp){if(!!resp.success){Main.app.run();echoResponseMessage(resp,function(){})}else Main.app.run()}}});Ext.define("Application.components.ContractUpdatePanel",{extend:"Ext.panel.Panel",layout:"form",labelWidth:350,initComponent:function(){var me=this;me.addEvents("contractupdatetypechanged");Ext.apply(me,{items:[{xtype:"radiogroup",fieldLabel:"\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435",name:"contract_update_type",ref:"contractUpdateTypeCmp",plugins:[Ext.ux.plugins.ToolTip],qtipConfig:{html:"\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u043f\u0443\u043d\u043a\u0442 \u00ab\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430\u00bb - \u0435\u0441\u043b\u0438 \u0431\u044b\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u044b \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430.\n"+ "\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u043f\u0443\u043d\u043a\u0442 \u00ab\u0418\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u0439\u00bb - \u0435\u0441\u043b\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0440\u0430\u043d\u0435\u0435 \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0435 \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f.",autoHide:false, applyTipTo:"label"},items:[{boxLabel:"\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430",name:"contract_update_type",inputValue:"M"},{boxLabel:"\u0418\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u0439",name:"contract_update_type",inputValue:"F",checked:true}],listeners:{change:function(cmp,radio){if(radio)me.fireEvent("contractupdatetypechanged",radio.getRawValue())},valueFilled:function(value){me.fireEvent("contractupdatetypechanged", value)}}},{xtype:"textarea",name:"modificationDescription",ref:"modificationDescriptionField",fieldLabel:"\u041f\u0440\u0438\u0447\u0438\u043d\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0435"+REQUIRED_FIELD,anchor:"100%",allowBlank:false},{xtype:"Application.components.dateField",format:"d.m.Y",anchor:null,width:200,allowBlank:false,fieldLabel:"\u0414\u0430\u0442\u0430 \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439"+ REQUIRED_FIELD,name:"approve_date",ref:"contractDateChangedCmp"},{xtype:"checkbox",name:"has_good_info",ref:"changeVolumeCmp",anchor:"100%",fieldLabel:"\u0418\u0437\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e\u0431 \u043e\u0431\u044a\u0435\u043c\u0435, \u0446\u0435\u043d\u0435 \u0437\u0430\u043a\u0443\u043f\u0430\u0435\u043c\u044b\u0445 \u0442\u043e\u0432\u0430\u0440\u043e\u0432, \u0440\u0430\u0431\u043e\u0442, \u0443\u0441\u043b\u0443\u0433 \u0438\u043b\u0438 \u0441\u0440\u043e\u043a\u0430\u0445 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430", listeners:{check:function(cmp,checked){me.contractChangeDocsGrid.setVisible(checked)}}},{xtype:"Application.components.ContractChangeDocsGrid",anchor:"100%",title:"\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e\u0431 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430",name:"contract_change_docs",ref:"contractChangeDocsGrid",autoHeight:true,hidden:true}],listeners:{contractupdatetypechanged:function(newValue){me.contractDateChangedCmp.setVisible(newValue== "M");me.changeVolumeCmp.setVisible(newValue=="M");if(me.changeVolumeCmp.isVisible())me.changeVolumeCmp.fireEvent("check",me.changeVolumeCmp,me.changeVolumeCmp.getValue());me.modificationDescriptionField.setValue("");if(newValue!="M")me.contractChangeDocsGrid.setVisible(false)},afterrender:function(){me.fireEvent("contractupdatetypechanged",me.contractUpdateTypeCmp.getRawValue())}}});Application.components.ContractUpdatePanel.superclass.initComponent.call(this)}});Ext.define("Application.components.ContractUploadDocsPanel",{extend:"Ext.form.FormPanel",border:false,hideTitle:false,frame:false,layout:"form",fileUpload:true,labelWidth:150,preventDuplicates:true,defaults:{anchor:"100%"},uploadButtonId:null,initComponent:function(){var me=this;me.addEvents("cancelled","uploadComplete");me.uploadButtonId=Ext.id();Ext.apply(me,{autoHeight:true,items:[{xtype:"fieldset",title:"",anchor:"100%",defaults:{anchor:"100%",allowBlank:false},items:[{html:'\u0414\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043f\u043e\u0437\u0438\u0446\u0438\u0439 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430, \u0441\u043a\u0430\u0447\u0430\u0439\u0442\u0435 \u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u0448\u0430\u0431\u043b\u043e\u043d. \u0417\u0430\u0442\u0435\u043c \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u0435 \u0435\u0433\u043e \u0432 \u0444\u043e\u0440\u043c\u0443 \u043d\u0438\u0436\u0435:', style:"padding: 0 0 10px 0"},{xtype:"fileuploadfield",ref:"../fileField",buttonText:"\u041e\u0431\u0437\u043e\u0440...",name:"file",allowBlank:false,fieldLabel:"\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0444\u0430\u0439\u043b"}]}],bodyCssClass:"subpanel-top-padding",buttons:[{text:"\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c",scope:this,id:me.uploadButtonId,formBind:true,handler:function(){if(!me.fileField.getValue()){alertError("\u041d\u0435 \u0432\u044b\u0431\u0440\u0430\u043d \u0444\u0430\u0439\u043b \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438!"); return}performSave(me,null,"uploadComplete",true)}},{text:"\u041e\u0442\u043c\u0435\u043d\u0430",handler:function(){me.fireEvent("cancelled")}}]});Application.components.ContractUploadDocsPanel.superclass.initComponent.call(this);this.form.api={submit:RPC.Ooscontract.parseXls};this.form.waitMsgTarget=true}});Ext.define("Application.components.ContractUploadLotUnitsPanel",{extend:"Ext.form.FormPanel",border:false,hideTitle:false,frame:false,layout:"form",fileUpload:true,labelWidth:150,preventDuplicates:true,defaults:{anchor:"100%"},uploadButtonId:null,initComponent:function(){var me=this;me.addEvents("cancelled","uploadComplete");me.uploadButtonId=Ext.id();Ext.apply(me,{autoHeight:true,items:[{xtype:"fieldset",title:"",anchor:"100%",defaults:{anchor:"100%",allowBlank:false},items:[{html:'\u0414\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043f\u043e\u0437\u0438\u0446\u0438\u0439 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430, \u0441\u043a\u0430\u0447\u0430\u0439\u0442\u0435 \u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u0448\u0430\u0431\u043b\u043e\u043d. \u0417\u0430\u0442\u0435\u043c \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u0435 \u0435\u0433\u043e \u0432 \u0444\u043e\u0440\u043c\u0443 \u043d\u0438\u0436\u0435:', style:"padding: 0 0 10px 0"},{xtype:"fileuploadfield",ref:"../fileField",buttonText:"\u041e\u0431\u0437\u043e\u0440...",name:"file",allowBlank:false,fieldLabel:"\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0444\u0430\u0439\u043b"}]}],bodyCssClass:"subpanel-top-padding",buttons:[{text:"\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c",scope:this,id:me.uploadButtonId,formBind:true,handler:function(){if(!me.fileField.getValue()){alertError("\u041d\u0435 \u0432\u044b\u0431\u0440\u0430\u043d \u0444\u0430\u0439\u043b \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438!"); return}performSave(me,null,"uploadComplete",true)}},{text:"\u041e\u0442\u043c\u0435\u043d\u0430",handler:function(){me.fireEvent("cancelled")}}]});Application.components.ContractUploadLotUnitsPanel.superclass.initComponent.call(this);this.form.api={submit:RPC.Contract.parseLotUnits};this.form.waitMsgTarget=true}});Application.components.uploadContractForm=Ext.extend(Ext.form.FormPanel,{border:false,hideTitle:false,frame:false,layout:"form",labelWidth:150,preventDuplicates:true,defaults:{anchor:"100%"},initComponent:function(){var component=this;var upload_field_id=Ext.id();this.addEvents("reload","uploadComplete","cancelled");this.items=this.items||[];this.uploadButtonId=Ext.id();this.items.push(new Ext.form.FileUploadField({buttonText:"\u041e\u0431\u0437\u043e\u0440...",name:"file",allowBlank:false,fieldLabel:"\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0444\u0430\u0439\u043b", id:upload_field_id}),{html:ACCEPTED_FILES},{xtype:"hidden",name:"id",value:component.params.id},{xtype:"hidden",name:"type_id",value:component.params.type_id},{xtype:"hidden",name:"current_customer",value:component.params.currentCustomer},{xtype:"hidden",name:"current_supplier",value:component.params.currentSupplier},{xtype:"hidden",name:"tab_index",value:component.params.tabIndex});Ext.apply(this,{bodyCssClass:"subpanel-top-padding",buttons:[{text:"\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c", scope:this,id:component.uploadButtonId,formBind:true,handler:function(){if(!!component.preventDuplicates)Ext.getCmp(component.uploadButtonId).disable();var upload_field=Ext.getCmp(upload_field_id);if(!upload_field.getValue()){alertError("\u041d\u0435 \u0432\u044b\u0431\u0440\u0430\u043d \u0444\u0430\u0439\u043b \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438!");Ext.getCmp(component.uploadButtonId).enable()}else{if(component.params.button_signed_disagreement)component.parentWin.button_signed_disagreement= false;if(component.params.button_signed_performance)component.parentWin.button_signed_performance=false;performSave(component,null,"uploadComplete",true)}}},{text:"\u041e\u0442\u043c\u0435\u043d\u0430",handler:function(){component.fireEvent("cancelled")}}],listeners:{reload:function(){component.componentParent.fireEvent("reload",component.filePanelId)}}});Application.components.uploadContractForm.superclass.initComponent.call(this);this.form.api={submit:RPC.Contract.add};this.form.waitMsgTarget=true}});Ext.define("Application.components.LogGrid",{extend:"Ext.grid.Panel",frame:true,border:false,id:"logPanel",exclude_service:true,getAdvancedSearchPanel:function(){var component=this;var ttbar=null;if(this.procedure_id==null){var pseudoList=this.getPseudoListStore();ttbar={xtype:"Application.components.searchToolbar",eventTarget:this,id:component.ids["searchToolBar"],searchHelp:"\u0411\u044b\u0441\u0442\u0440\u044b\u0439 \u043f\u043e\u0438\u0441\u043a \u043f\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e", advancedSearch:[{xtype:"dateinterval",name:"date_range",fieldLabel:"\u0414\u0430\u0442\u0430"},{xtype:"textfield",name:"event_id",fieldLabel:"ID \u0441\u043e\u0431\u044b\u0442\u0438\u044f"},{xtype:"textfield",name:"procedure_registry_number",fieldLabel:"\u0420\u0435\u0435\u0441\u0442\u0440\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b"},{xtype:"textfield",name:"company_name",fieldLabel:"\u041d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438"}, {xtype:"textfield",name:"user_id",fieldLabel:"ID \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f"},{xtype:"textfield",name:"user_login",fieldLabel:"\u041b\u043e\u0433\u0438\u043d \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f"},{xtype:"textfield",name:"company_inn",fieldLabel:"\u0418\u041d\u041d \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438"},{xtype:"combo",name:"api_resource_id",valueField:"id",displayField:"title",store:pseudoList, value:"",mode:"local",typeAhead:true,minChars:3,forceSelection:true,triggerAction:"all",editable:true,selectOnFocus:false,fieldLabel:"\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435"},{xtype:"checkbox",name:"exclude_service",fieldLabel:"\u0418\u0441\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439",checked:true}]};if(component.logtype=="error")ttbar["advancedSearch"].push({xtype:"checkbox", name:"hide_login_errors",fieldLabel:"\u0421\u043a\u0440\u044b\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438 \u043b\u043e\u0433\u0438\u043d\u0430"})}else{var user_type=null;user_type=this.getUserType();var pseudoList=this.getPseudoListStore(true,user_type);ttbar=new Ext.Toolbar({layout:"hbox",items:["\u0422\u0438\u043f \u0441\u043e\u0431\u044b\u0442\u0438\u044f:",{xtype:"tbspacer",width:5},{xtype:"Application.components.comboValued",name:"api_resource_id",valueField:"id",displayField:"title",store:pseudoList, defaultValue:"0",anchor:"100%",mode:"local",typeAhead:true,minChars:3,flex:1,forceSelection:true,triggerAction:"all",editable:true,selectOnFocus:false,fieldLabel:"\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435",listeners:{select:function(cmp,record,i){component.fireEvent("search","",{api_resource_id:record.get("id")})}}}]})}return ttbar},initComponent:function(){var component=this;component.ids=initIds(["searchToolBar"]);this.addEvents("search");if(!this.procedure_id)this.procedure_id=null;var store= this.getLogStore();var buttons=[];if(this.module=="po")buttons.push({text:"\u0412\u044b\u0433\u0440\u0443\u0437\u0438\u0442\u044c",handler:function(){var params=Ext.apply({},store.baseParams);var sort=store.getSortState();Ext.apply(params,{format:"excel",start:0,limit:500,sort:sort.field,dir:sort.direction});performAjaxRPCCall("/log/procedurelog",params,{download:true,wait_disable:true},echoResponseMessage)}});Ext.apply(this,{store:store,columns:this.getGridColumns(),viewConfig:{forceFit:true},tbar:this.getAdvancedSearchPanel(), bbar:renderPagingToolbar("\u0417\u0430\u043f\u0438\u0441\u0438",store,50),loadMask:true,buttons:buttons,listeners:{render:function(){this.fireEvent("search")},search:function(query,search_params){var store=this.getStore();if(search_params)for(var sp in search_params)store.setBaseParam(sp,search_params[sp]);store.setBaseParam("query",query);store.setBaseParam("start",0);store.setBaseParam("limit",50);store.load()}}});Application.components.LogGrid.superclass.initComponent.call(this)},getGridColumns:function(){var component= this;var grid_columns=[];var actionRenderer=function(value,metaData,record,rowIndex,colIndex,store){if(!isEmpty(record.get("pseudo"))&&!isEmpty(record.get("message"))){var message_array=record.get("message").split("\n");if(message_array.length>1)return message_array[0]}return record.get("pseudo")};if(!component.procedure_id)grid_columns.push({header:"ID \u0441\u043e\u0431\u044b\u0442\u0438\u044f",width:40,dataIndex:"id",sortable:true});grid_columns.push({header:"\u0414\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043c\u044f", width:50,dataIndex:"timestamp",renderer:Ext.util.Format.dateRenderer("d.m.Y H:i:s"),sortable:true});if(!component.procedure_id){grid_columns.push({header:"\u041f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430",dataIndex:"registry_number",width:40,sortable:true,css:"text-decoration: underline; cursor: pointer;",listeners:{click:function(col,grid,rowIndex){var store=grid.getStore();var record=store.getAt(rowIndex);var sBar=Ext.getCmp(component.ids["searchToolBar"]);if(sBar){sBar.setValues({query:record.get("registry_number")}); sBar.doSearch()}}}});grid_columns.push({header:"\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435",dataIndex:"pseudo",width:120,sortable:true,renderer:actionRenderer})}else grid_columns.push({header:"\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435",dataIndex:"pseudo",width:120,renderer:actionRenderer,sortable:true});if(component.procedure_organizer&&component.procedure_organizer==Main.user.contragent_id||isAdmin())grid_columns.push({header:"\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c", dataIndex:"username",width:50,sortable:true});grid_columns.push({header:"\u041e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044f",dataIndex:"company",width:80,sortable:true},{header:"\u0421\u0442\u0430\u0442\u0443\u0441",dataIndex:"status",width:30,sortable:true});if(component.logtype==="eds"||component.logtype==="procedure")grid_columns.push({header:"\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u0438",xtype:"textactioncolumn",width:40,actionsSeparator:" ",items:[{tooltip:"\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0438", icon:"/ico/eds.png",isHidden:function(v,m,r){return!r.data.event_eds||r.data.event_eds===""||r.data.event_eds==="a"},handler:function(grid,rowIndex){var item=grid.getStore().getAt(rowIndex);if(item)performRPCCall(RPC.Log.loadedslog,[{id:item.data.id}],{wait_text:"\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435"},function(response){var wnd_eds=new Ext.Window({title:"\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0438", width:700,height:400,layout:"form",bodyStyle:"padding: 12px 10px 10px 5px",labelWidth:1,modal:true,hideFieldLabel:true,items:[{xtype:"textarea",anchor:"100%",height:312,readOnly:true,value:response.data}],buttons:[{text:"\u0417\u0430\u043a\u0440\u044b\u0442\u044c",handler:function(){wnd_eds.close()}}]});wnd_eds.show()})}},{tooltip:"\u041a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 PKCS#7",icon:"/ico/sign.png",text:"",isHidden:function(v,m,r){return!r.data.event_eds||r.data.event_eds===""||r.data.event_eds=== "a"},handler:function(grid,rowIndex){var item=grid.getStore().getAt(rowIndex);window.location="/log/downloadeds/id/"+item.data.id}}]});else grid_columns.push({header:"\u0421\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435",dataIndex:"message",width:60,sortable:true});if(isAdmin())grid_columns.push({header:"IP",dataIndex:"ip_address",width:60,sortable:true,hidden:true});return grid_columns},getLogStore:function(){var component=this;var type=this.logtype;var procedure_id=this.procedure_id;var direct_fn= RPC.Log.index;if(type=="procedure")direct_fn=RPC.Log.procedurelog;else if(type=="sync")direct_fn=RPC.Log.synclog;var store=new Ext.data.DirectStore({directFn:direct_fn,paramsAsHash:true,autoSave:true,root:"entries",idProperty:"id",totalProperty:"totalCount",fields:this.getStoreFields(),sortInfo:{field:"timestamp",direction:"DESC"},baseParams:{logtype:type,procedure_id:procedure_id,exclude_service:component.exclude_service},remoteSort:true});return store},getStoreFields:function(){var storeFields= ["id","pseudo","username",{name:"timestamp",type:"date",dateFormat:"c"},"status","message","company","lot_number","event_eds","supplier_profile_id","registry_number","contragent_id","ip_address"];return storeFields},getPseudoListStore:function(all_actions,user_type){var storeConfig={directFn:RPC.Log.getPseudoList,idProperty:"id",root:"list",autoLoad:true,fields:["id","title"]};var store_id="pseudo_list";if(!!all_actions){storeConfig["baseParams"]={all_actions:true};if(!!user_type){storeConfig["baseParams"]["user_type"]= user_type;store_id=store_id+"_"+user_type}}var pseudoListStore=getStore(store_id,storeConfig);return pseudoListStore},getUserType:function(){var user_type=[];if(isAdmin())user_type.push("admin");if(isSupplier())user_type.push("supplier");if(isCustomer())user_type.push("customer");return user_type}});Ext.define("Application.components.SynclogGrid",{extend:"Application.components.LogGrid",frame:true,border:false,getDirectionToStore:function(){return new Ext.data.ArrayStore({fields:["id","name"],data:[["etp","\u042d\u0422\u041f"],["plans","\u041f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435"]]})},getObjectNameStore:function(){return new Ext.data.ArrayStore({fields:["id","name"],data:[["Model_Procedure","\u041f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430"]]})},getAdvancedSearchPanel:function(){var component= this;var ttbar=null;ttbar={xtype:"Application.components.searchToolbar",eventTarget:this,id:component.ids["searchToolBar"],searchHelp:"\u0411\u044b\u0441\u0442\u0440\u044b\u0439 \u043f\u043e\u0438\u0441\u043a \u043f\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e",advancedSearch:[{xtype:"dateinterval",name:"date_range",fieldLabel:"\u0414\u0430\u0442\u0430"},{xtype:"combo",name:"direction_to",fieldLabel:"\u041d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438", store:component.getDirectionToStore(),triggerAction:"all",mode:"local",editable:false,displayField:"name",valueField:"id"},{xtype:"combo",name:"object_name",fieldLabel:"\u0422\u0438\u043f \u043e\u0431\u044a\u0435\u043a\u0442\u0430",store:component.getObjectNameStore(),triggerAction:"all",mode:"local",editable:false,displayField:"name",valueField:"id"},{xtype:"textfield",name:"object_id",fieldLabel:"ID \u043e\u0431\u044a\u0435\u043a\u0442\u0430"}]};return ttbar},initComponent:function(){var component= this;Application.components.SynclogGrid.superclass.initComponent.call(component)},getStoreFields:function(){var storeFields=["id","timestamp","object_name","object_id","success","direction_to","result_message"];return storeFields},getGridColumns:function(){var component=this;var grid_columns=[];grid_columns.push({header:"ID \u0441\u043e\u0431\u044b\u0442\u0438\u044f",width:40,dataIndex:"id",sortable:true});grid_columns.push({header:"\u0414\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043c\u044f", width:50,dataIndex:"timestamp",renderer:Ext.util.Format.dateRenderer("d.m.Y H:i:s"),sortable:true});grid_columns.push({header:"\u041d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435",width:50,dataIndex:"direction_to",sortable:true});grid_columns.push({header:"\u0418\u043c\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430",width:50,dataIndex:"object_name",sortable:true,renderer:component.objectNameRenderer});grid_columns.push({header:"ID \u043e\u0431\u044a\u0435\u043a\u0442\u0430",width:50, dataIndex:"object_id",sortable:true});grid_columns.push({header:"\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442",width:50,dataIndex:"success",renderer:function(v){return v?"\u0423\u0441\u043f\u0435\u0448\u043d\u043e":"\u041e\u0448\u0438\u0431\u043a\u0430"}});grid_columns.push({header:"\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u0438",width:20,xtype:"textactioncolumn",actionsSeparator:"
",items:[{icon:"/ico/settings/browse.png",handler:function(grid,rowIndex){var store=grid.getStore(); var record=store.getAt(rowIndex);var win=new Ext.Window({title:"\u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043e\u0442\u0432\u0435\u0442\u0430",width:600,height:400,layout:"fit",modal:true,bodyStyle:"padding: 10px",items:[{xtype:"textarea",value:record.get("result_message")}],buttons:[{text:"\u0417\u0430\u043a\u0440\u044b\u0442\u044c",handler:function(){win.close()}}]});win.show()}}]});return grid_columns},objectNameRenderer:function(value){switch(value){case "Model_Procedure":return"\u041f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430"}return value}});Ext.define("Application.components.ContractsTabPanel",{extend:"Ext.TabPanel",plugins:[Ext.ux.plugins.TabStateful],additional:false,newtabs:false,initComponent:function(){var me=this;var items=[{title:"\u0414\u043e\u0433\u043e\u0432\u043e\u0440\u044b",xtype:"Application.components.ProcedureGrid",filter:me.filter,contractType:"contract"},{title:"\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f",xtype:"Application.components.ProcedureGrid", filter:me.filter,contractType:"additional"}];me.secondFilter=me.secondFilter||"contractarchive";var filter=me.filter;if(["mycontract","addcontract"].includes(me.filter)){if(me.filter=="addcontract")me.additional=true;filter="contract";me.newtabs=true;me.secondFilter="contractarchive"}if(me.newtabs){var contractType="contract";if(me.additional)contractType="additional";items=[{title:"\u041d\u0430 \u044d\u0442\u0430\u043f\u0435 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f",xtype:"Application.components.ProcedureGrid", filter:filter,contractType:contractType},{title:"\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0435",xtype:"Application.components.ProcedureGrid",filter:me.secondFilter,contractType:contractType}]}Ext.apply(me,{items:items});Application.components.ContractsTabPanel.superclass.initComponent.call(this)}});Ext.define("Application.components.FeesGrid",{extend:"Ext.grid.Panel",initComponent:function(){var me=this;Ext.apply(me,{store:me.store,columns:me.getColumns(),viewConfig:{forceFit:true,autoFill:true}});Application.components.FeesGrid.superclass.initComponent.call(this)},getColumns:function(){return[{header:"\u041d\u0430\u0447\u0430\u043b\u044c\u043d\u0430\u044f \u0446\u0435\u043d\u0430 \u0441 ",flex:1,dataIndex:"price_from",sortable:true,renderer:Application.components.util.Format.priceRenderer()}, {header:"\u043f\u043e",flex:1,dataIndex:"price_to",hidden:false,sortable:true,renderer:Application.components.util.Format.priceRenderer()},{header:"\u0422\u0430\u0440\u0438\u0444 (\u0440\u0443\u0431)",flex:1,dataIndex:"sum",renderer:Application.components.util.Format.priceRenderer()}]}});Ext.define("Application.components.FeesGridPanel",{extend:"Ext.panel.Panel",type:"avt_tariffs",frame:true,getStore:function(config){return new Ext.data.DirectStore({autoLoad:true,directFn:RPC.Admin.getFees,idProperty:"id",baseParams:config||{},paramsAsHash:true,root:"entries",remoteSort:true,fields:[{name:"id",type:"int"},{name:"price_from"},{name:"price_to"},{name:"sum"}]})},initComponent:function(){var me=this;Ext.apply(me,{items:[{xtype:"fieldset",title:"\u0422\u0430\u0440\u0438\u0444\u043d\u0430\u044f \u0441\u0435\u0442\u043a\u0430", items:[{xtype:"Application.components.FeesGrid",height:500,store:me.getStore({type:me.type})}]},{xtype:"fieldset",title:"\u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0430\u0440\u0438\u0444\u0430",items:[{xtype:"Application.components.priceField",ref:"../input",fieldLabel:"\u041d\u0430\u0447\u0430\u043b\u044c\u043d\u0430\u044f \u0446\u0435\u043d\u0430"},{xtype:"button",text:"\u0420\u0430\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0442\u0430\u0440\u0438\u0444",handler:function(){var price= me.input.getValue();performRPCCall(RPC.Admin.testFees,[{price:price,type:me.type}],[],function(resp){echoResponseMessage(resp)})}}]}]});Application.components.FeesGridPanel.superclass.initComponent.call(this)}});Ext.define("Application.components.GrantAccessGrid",{extend:"Ext.form.Panel",border:false,layout:"fit",initComponent:function(){var proc_id=this.proc_id;var grant_access_grid_id=Ext.id();var store=createShareProcAccessStore(proc_id);var grid=new Ext.grid.GridPanel({id:grant_access_grid_id,store:store,ref:"../grid",colModel:new Ext.grid.ColumnModel({defaults:{width:120,autoHeight:true,sortable:true},columns:[{header:"\u041d\u043e\u043c\u0435\u0440",dataIndex:"id",width:20,hidden:true,sortable:true}, {header:"\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c",dataIndex:"user",flex:1,sortable:true},{header:"\u0424.\u0418.\u041e",dataIndex:"user_fio",flex:1,sortable:true},{header:"\u041e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044f",dataIndex:"company_name",flex:1,sortable:true},{header:"\u0412\u044b\u0431\u0440\u0430\u0442\u044c",dataIndex:"choose",width:20,xtype:"checkcolumn",sortable:false}]}),viewConfig:{forceFit:true},sm:new Ext.grid.RowSelectionModel({singleSelect:true}), iconCls:"icon-grid",listeners:{update:function(store){store.save()}}});Ext.apply(this,{items:[grid]});Application.components.GrantAccessGrid.superclass.initComponent.call(this)}});Ext.define("Application.components.LotExtendedApplicRegistrationPanel",{extend:"Ext.form.FieldSet",frame:false,border:true,initComponent:function(){var component=this;this.lot_id=null;this.ids={extended_applic_registration_id:Ext.id()};Ext.apply(this,{layout:"form",labelWidth:1,items:[{xtype:"checkbox",id:this.ids.extended_applic_registration_id,boxLabel:"\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u043e\u0439 \u043f\u043e\u0434\u0430\u0447\u0438 \u0437\u0430\u044f\u0432\u043e\u043a"}], buttons:[{text:"\u041f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c",handler:function(){var selector=Ext.getCmp(component.ids.extended_applic_registration_id);performRPCCall(RPC.Lot.extendedApplicRegistration,[{lot_id:component.lot_id,extended_applic_registration:selector.getValue()}],{wait_delay:0,wait_text:"\u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u0442\u0443\u0441\u0430. \u041f\u043e\u0434\u043e\u0436\u0434\u0438\u0442\u0435..."},function(result){if(result.success)Ext.Msg.alert("\u0423\u0441\u043f\u0435\u0448\u043d\u043e", "\u0414\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u044b")})}}]});Application.components.LotExtendedApplicRegistrationPanel.superclass.initComponent.call(this);this.on("applic_reviewlist_loaded",function(resp){if(!Main.config.extended_applic_registration_quotation||resp.procedure.procedure_type!=PROCEDURE_TYPE_QUOTATION_REQ){component.setVisible(false);component.setDisabled(true)}var selector=Ext.getCmp(component.ids.extended_applic_registration_id);if(false=== resp.lot.extended_applic_registration)selector.setValue(false);else selector.setValue(true);component.lot_id=resp.lot.id})}});Ext.define("Application.components.OffersGrid",{extend:"Ext.form.Panel",frame:true,border:false,initComponent:function(){var component=this;var store=createOffersLogStore(this.lot_id);var dataGridColumns=[{header:"\u2116",width:10,dataIndex:"id",sortable:false},{header:"\u0423\u0447\u0430\u0441\u0442\u043d\u0438\u043a",flex:1,dataIndex:"supplier",sortable:false},{header:"\u0426\u0435\u043d\u0430 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f",dataIndex:"price",width:40,sortable:false, renderer:Ext.util.Format.formatPrice},{header:"\u0422\u0438\u043f \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f",dataIndex:"is_additional_offer",width:70,sortable:false,renderer:function(val){return!val?"\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0442\u043e\u0440\u0433\u0438":"\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0442\u043e\u0440\u0433\u0438"}},{header:"\u0414\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u0434\u0430\u0447\u0438", dataIndex:"date_added",sortable:false,renderer:Ext.util.Format.dateRenderer("d.m.Y H:i:s.u")}];var grid=new Ext.grid.GridPanel({store:store,clicksToEdit:1,cm:new Ext.grid.ColumnModel({columns:dataGridColumns}),viewConfig:{forceFit:true},autoHeight:false,anchor:"100% 100%",hideTitle:true,loadMask:true,listeners:{render:function(){var store=this.getStore();store.load()}}});Ext.apply(this,{store:store,items:[grid],buttons:[{text:"\u0412\u044b\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a", hidden:component.procedure_data.organizer_contragent_id!=Main.contragent.id,handler:function(){var url="/Offer/listApplicOffers";var params={lot_id:component.lot_id,viewlist_action:"download",format:"htmljson"};var dparams={handle_failure:true,download:true,wait_disable:true};performAjaxRPCCall(url,params,dparams,echoResponseMessage)}}]});Application.components.OffersGrid.superclass.initComponent.call(this)}});Application.components.ProcedureChangeDatesForm=Ext.extend(Ext.form.FormPanel,{frame:false,border:false,initComponent:function(){var component=this;this.ids={date_published_id:Ext.id()};component.date_published_fld=new Application.components.dateField({fieldLabel:"\u0414\u0430\u0442\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b"+REQUIRED_FIELD,xtype:"Application.components.dateField",id:this.ids.date_published_id,format:"d.m.Y", altFormats:"c|d.m.Y H:i:s|d.m.Y H:i",anchor:null,name:"date_published",width:200,value:now(),minValue:new Date});component.stepGridStore=new Ext.data.JsonStore({autoDestroy:true,autoLoad:false,idProperty:"id",autoSave:false,paramsAsHash:true,fields:["id","order_number","step_id","date_start","date_end","time_start","time_end"],data:Application.models.Procedure.prepareStepsData(Application.models.Procedure.getType("2").steps,null,2)});component.typesStore=Application.models.Procedure.getTypesStoreFromRPC(); component.typesStore.load();this.addEvents("procedurechanged");Ext.apply(this,{labelWidth:300,frame:true,autoScroll:true,bodyCssClass:"subpanel-top-padding",items:[{xtype:"hidden",name:"lot_id",value:component.lot_id},{xtype:"fieldset",title:"\u042d\u0442\u0430\u043f\u044b \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b",labelWidth:400,defaults:{labelWidth:400},items:[component.date_published_fld,new Application.components.procedureMultistepGrid({anchor:"100%", frame:false,editable:true,autoScroll:true,autoHeight:true,addstep:false,editstep:Main.config.multistep_edit_support,border:false,loadMask:true,parent:component,baseDate:new Date,listeners:{added:function(){this.addEvents("procedurechanged");this.relayEvents(component,["procedurechanged"]);this.addEvents("stageschanged");this.relayEvents(component,["stageschanged"])}}})]}],buttons:[{text:"\u041f\u0435\u0440\u0435\u0432\u0435\u0441\u0442\u0438 \u0441\u0440\u043e\u043a\u0438",scope:this,formBind:true, handler:function(){var parameters=this.getValues();performRPCCall(RPC.Lot.changeLotDates,[parameters],{wait_text:"\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c\u0441\u044f"},function(result){if(result.success)Ext.Msg.alert("\u0423\u0441\u043f\u0435\u0448\u043d\u043e","\u0421\u0440\u043e\u043a\u0438 \u043b\u043e\u0442\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u044b",function(){history.back()});else echoResponseMessage(result)})}},{text:"\u0417\u0430\u043a\u0440\u044b\u0442\u044c", handler:function(){history.back()}}],listeners:{beforerender:function(){Ext.getBody().mask("\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435");RPC.Lot.loadLotDates(component.lot_id,function(resp){if(resp.success){var visible,i,item,steps;component.setTitle("\u041f\u0435\u0440\u0435\u0432\u043e\u0434 \u0441\u0440\u043e\u043a\u043e\u0432 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043b\u043e\u0442\u0430 \u2116"+resp.procedure.lot.number+ " \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b "+resp.procedure.registry_number);component.procedure=resp.procedure;component.lot=resp.procedure.lot;component.procedure_type=resp.procedure.procedure_type;component.procedure_type_id=resp.procedure.procedure_type;component.procedureDateSettings=component.typesStore.getById(component.procedure_type).data;Ext.getCmp(component.ids.date_published_id).setValue(resp.procedure.date_published);component.fireEvent("procedurechanged",resp.procedure.procedure_type); var type=Application.models.Procedure.type_ids[component.procedure_type];if(component.lot.steps&&component.lot.steps!="[]")steps=Ext.util.JSON.decode(component.lot.steps);if(!steps||!steps.length)steps=Application.models.Procedure.getType(component.procedure_type).steps;component.stepGridStore.loadData(Application.models.Procedure.prepareStepsData(steps,component.lot.status,component.procedure_type,{with_preregistration:component.procedure.with_preregistration,with_prequalification:component.procedure.with_prequalification, with_notice_discussion:component.procedure.with_notice_discussion,with_first_parts_discussion:component.procedure.with_first_parts_discussion}));component.fireEvent("stageschanged",resp.procedure.applic_stages)}else Ext.Msg.alert("\u041e\u0448\u0438\u0431\u043a\u0430",resp.message);Ext.getBody().unmask()})}},getValues:function(){var dt=null;var v={};collectComponentValues(this,v,true);if(v.steps.length)for(var c=0;c'+'\u041b\u043e\u0442 {number}'+"{subject}"+(isCustomerSpecorg()&&Main.config.customers_search_for_specorg?"{customers}":"")+(isAdmin()||isCustomer()&&(Main.contragent.id==record.data.organizer_contragent_id|| show_count_to_customer)&&view_applics_separate==true?'{applics_count}':"")+'{price}'+'{status}'+'{actions}'+"")},getExpander:function(){var actions=this.actions;var cmp=this;return new Ext.ux.grid.RowExpander({createExpandingRowPanelItems:function(grid,store,record,rowIndex){var items=[];var d,l,link,title,j,action_tpls=[];var expander_template=cmp.getExpanderTemplate(record);for(j=0;j')}else{l.lot_id=l.id;if(actions[j].NoIcon)d.actions.push('');else d.actions.push('')}}d.actions=d.actions.join(" ");(function(l,lot){items.push({xtype:"panel",border:false,frame:false,autoHeight:true,cls:"grid-lot-item x-color-"+l.status,bodyCssClass:"spaced-panel cleanbackground",html:expander_template.apply(d),data:d,listeners:{afterrender:function(cmp){for(var i=0;i'+ v+"";if(isAdmin()&&!!r.data["skip_winner_tariff"])v+=' ';if(!v||v=="null")return"";return''+ v+""},procTypeRenderer:function(v,m,r){var t=Application.models.Procedure.getType(v);var images={1:"/ico/procedures/bidding_up_auctions.png",2:"/ico/procedures/bidding_down_auctions.png",3:"/ico/procedures/contests.png",4:"/ico/procedures/rate_requests.png",5:"/ico/chart.png",6:"/ico/all.png",10:"/images/icons/silk/coins.png",51:"/ico/newrequest.png",17:"/ico/status0.png",54:"/ico/procedures/rate_requests.png",100:"/ico/cart.png"};var name=t?t.name:"";if(r.data["private"])name+=" (\u0437\u0430\u043a\u0440\u044b\u0442\u0430\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430)"; return''+name+''},ApplicsCountRenderer:function(v,m,r){if(r.data["applics_count"])return r.data["applics_count"];else return"0"},dateRenderer:function(v,m,rec,n,f){v=parseDate(v);if(!v)return"\u2014";var updatecheck_rows=["date_end_registration","date_begin_auction","date_end_correction","date_end_add_price_registration"];var r;if(f&&updatecheck_rows.indexOf(f)<0)r=Ext.util.Format.date(v,"d.m.Y");else r=Ext.util.Format.date(v, "d.m.Y H:i");if(f&&updatecheck_rows.indexOf(f)>=0){var now=new Date;var status=2;if(rec&&undefined!==n)status=rec.data.lots[n].status;if(v>now&&status!=10&&status!=8)r+="
\n\u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c "+Ext.util.Format.interval(v-now,{langCase:"nominative",isMs:true,lowPrecision:true});if(rec&&undefined!==n&&f)rec.data.lots[n][f+"_rendered"]=r}return r},currencyRenderer:function(value,meta,record){var currency_name=record.data.currency_name;var currency_description=record.data.currency_description; var c=false;if(!value)return"\u2014";if(currency_name){c=renderCurrencySign(currency_name);if(currency_description)c=''+c+""}return Ext.util.Format.formatPrice(value)+(c?" "+c:"")},rubleCurrencyRenderer:function(value,meta,record){var currency_name="RUB";var currency_description="\u0420\u043e\u0441\u0441\u0438\u0439\u0441\u043a\u0438\u0439 \u0440\u0443\u0431\u043b\u044c";var c=false;if(!value)return"\u2014";if(currency_name){c=renderCurrencySign(currency_name); if(currency_description)c=''+c+""}return Ext.util.Format.formatPrice(value)+(c?" "+c:"")},customersRenderer:function(v,m,r,l){return v}});Ext.define("Application.components.ProcedureCoordination",{extend:"Ext.form.FieldSet",frame:false,border:true,initComponent:function(){var component=this;var coordination_id=Ext.id(),resolved_id=Ext.id(),declined_id=Ext.id(),coordination_status_id=Ext.id(),old_coordination_status_id=Ext.id();Ext.apply(this,{layout:"form",labelWidth:1,items:[{xtype:"hidden",name:"old_coordination_status",id:old_coordination_status_id,value:null},{xtype:"hidden",name:"coordination_status",id:coordination_status_id, setValues:function(coordination_status){Ext.getCmp(old_coordination_status_id).setValue(coordination_status);if(component.parent.procedure_organizer_department_id!=Main.user.department_id){component.setVisible(false);return}var coordination=Ext.getCmp(coordination_id);var resolved=Ext.getCmp(resolved_id);var declined=Ext.getCmp(declined_id);coordination.setDisabled(true);resolved.setDisabled(true);declined.setDisabled(true);if(Main.user.department_role_id==DEPARTMENT_ROLE_SPECIALIST&&(!coordination_status|| coordination_status==COORDINATION_STATUS_DECLINED))coordination.setDisabled(false);else if(Main.user.department_role_id==DEPARTMENT_ROLE_HEAD&&coordination_status==COORDINATION_STATUS_COORDINATION){coordination.setValue(true);resolved.setVisible(true);resolved.setDisabled(false);declined.setVisible(true);declined.setDisabled(false)}else if(coordination_status==COORDINATION_STATUS_COORDINATION){coordination.setValue(true);resolved.setVisible(true)}else if(coordination_status==COORDINATION_STATUS_RESOLVED){coordination.setValue(true); resolved.setVisible(true);resolved.setValue(true)}},getValues:function(){var coordination=Ext.getCmp(coordination_id).getValue();var resolved=Ext.getCmp(resolved_id).getValue();var declined=Ext.getCmp(declined_id).getValue();var coordination_status=null;if(coordination&&!resolved&&!declined)coordination_status=COORDINATION_STATUS_COORDINATION;if(coordination&&resolved)coordination_status=COORDINATION_STATUS_RESOLVED;if(coordination&&declined)coordination_status=COORDINATION_STATUS_DECLINED;return coordination_status}}, {xtype:"checkbox",id:coordination_id,disabled:true,boxLabel:"\u041d\u0430\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043d\u0430 \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u0438\u0435",listeners:{check:function(){component.updateCoordinationStatus()}}},{xtype:"checkbox",id:resolved_id,disabled:true,hidden:true,boxLabel:"\u041e\u0442\u043c\u0435\u0442\u043a\u0430 \u043e \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u0438\u0438",listeners:{check:function(obj,checked){var declined= Ext.getCmp(declined_id);if(checked&&declined.getValue())declined.setValue(false);component.updateCoordinationStatus()}}},{xtype:"checkbox",id:declined_id,disabled:true,hidden:true,boxLabel:"\u041d\u0435 \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u043e",listeners:{check:function(obj,checked){var resolved=Ext.getCmp(resolved_id);if(checked&&resolved.getValue())resolved.setValue(false);component.updateCoordinationStatus()}}}],updateCoordinationStatus:function(){var coordination_status= Ext.getCmp(coordination_status_id);coordination_status.setValue(coordination_status.getValues())},listeners:{}});Application.components.ProcedureCoordination.superclass.initComponent.call(this)}});Ext.define("Application.components.ProcedureDecisionForm",{extend:"Ext.panel.Panel",border:false,frame:true,autoHeight:true,layout:"form",labelWidth:350,protocols:[],file:null,select_participant:false,initComponent:function(){var component=this;this.ids={button_confirm:Ext.id(),contract_confirm_fieldset:Ext.id(),contract_confirm_select_fieldset:Ext.id(),is_contract_sign:Ext.id(),contract_sign_contragent_id:Ext.id(),signature_required_id:Ext.id()};this.forms={nothing_to_confirm:{xtype:"fieldset",style:"margin: 10px 5px 0px;", bodyCssClass:"subpanel",items:[{html:"\u041d\u0435\u0442 \u043b\u043e\u0442\u043e\u0432 \u0434\u043b\u044f \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f"}]},contract_confirm:{xtype:"fieldset",anchor:"100%",style:"margin: 10px 5px 0px;",bodyCssClass:"subpanel",title:"\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430",id:this.ids.contract_confirm_fieldset,items:[{html:"\u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u044b\u0431\u043e\u0440\u0430 \u043f\u0438\u0441\u044c\u043c\u0435\u043d\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u044b \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430, \u0412\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044c \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e "+ (!Main.config.contract_final_step?"\u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0430 \u0432 \u0430\u0440\u0445\u0438\u0432 \u0438 ":"")+'\u0434\u0435\u043d\u0435\u0436\u043d\u044b\u0435 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 \u0443 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u0432 \u0440\u0430\u0437\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0442\u0441\u044f. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0443\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430 \u043e\u0442 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430, \u0412\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0442\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430 \u0438 \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0442\u043a\u0430\u0437\u0430 \u0432 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0438 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430 "\u0423\u043a\u043b\u043e\u043d\u0438\u043b\u0441\u044f \u043e\u0442 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430", \u0434\u0435\u043d\u0435\u0436\u043d\u044b\u0435 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 \u0443\u043a\u043b\u043e\u043d\u0438\u0441\u0442\u0430 \u043e\u0441\u0442\u0430\u043d\u0443\u0442\u0441\u044f \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0442\u043a\u0430\u0437\u0430 \u043e\u0442 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u0441 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u00ab\u0418\u043d\u043e\u0435\u00bb, \u0434\u0435\u043d\u0435\u0436\u043d\u044b\u0435 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 \u0443 \u043f\u043e\u0431\u0435\u0434\u0438\u0442\u0435\u043b\u044f \u0440\u0430\u0437\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0442\u0441\u044f.', style:"padding-bottom: 20px; font-size: 12px;"}]},contract_confirm_select:{xtype:"fieldset",anchor:"100%",style:"margin: 10px 5px 0px;",bodyCssClass:"subpanel",title:"\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430",id:this.ids.contract_confirm_select_fieldset,items:[{xtype:"combo",id:this.ids.is_contract_sign,name:"is_contract_sign",fieldLabel:"\u0417\u0430\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0434\u043e\u0433\u043e\u0432\u043e\u0440", mode:"local",store:new Ext.data.ArrayStore({id:0,fields:["id","name"],data:[[1,"\u0414\u0430"],[0,"\u041d\u0435\u0442"]]}),editable:false,valueField:"id",displayField:"name",triggerAction:"all",value:1,listeners:{select:function(cmp,v,val){var contract_sign_contragent_cmp=Ext.getCmp(component.ids.contract_sign_contragent_id);var signature_required_cmp=Ext.getCmp(component.ids.signature_required_id);if(contract_sign_contragent_cmp)contract_sign_contragent_cmp.setDisabled(!!val);if(signature_required_cmp)signature_required_cmp.setDisabled(!!val)}}}, {xtype:"combo",id:this.ids.contract_sign_contragent_id,name:"contract_sign_contragent_id",fieldLabel:"\u0423\u0447\u0430\u0441\u0442\u043d\u0438\u043a \u0434\u043b\u044f \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430",mode:"local",anchor:"100%",store:new Ext.data.ArrayStore({id:0,fields:["id","name"],data:[]}),editable:false,valueField:"id",displayField:"name",triggerAction:"all",value:1}]}};this.items=[];if(!this.hideButtons){var dparams= {mask:true,wait_text:"\u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435",handle_failure:true};this.buttons=[{text:"\u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044c",id:this.ids.button_confirm,handler:function(){var values=component.getValues();if(component.select_participant){component.sign_window_id=Ext.id();var win=new Application.components.promptWindow({title:"\u041f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0444\u043e\u0440\u043c\u044b", cmpType:"Application.components.SignatureForm",parentCmp:this,id:component.sign_window_id,cmpParams:{api:RPC.Procedure.makedecision,signatureText:component.getSubmitSignatureText(values),signatureTextHeight:250,useFormHandler:false,formValues:values,success_fn:function(resp){win.close();echoResponseMessage({success:true,message:resp.new_status},function(){window.location="/"})}}});win.show()}else performRPCCall(RPC.Procedure.makedecision,[values],dparams,function(resp){echoResponseMessage({success:true, message:resp.new_status},function(){window.location="/"})})}},"->",{text:"\u041f\u0440\u0438\u043d\u044f\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043f\u043e\u0437\u0436\u0435",handler:function(){var params=component.getValues();if(isEmpty(params)){window.location="/";return}params.signatureRequired=null;params.deferedDecision=true;performRPCCall(RPC.Procedure.makedecision,[params],dparams,function(resp){echoResponseMessage({success:true,message:resp.new_status},function(){window.location= "/"})})}}]}Application.components.ProcedureDecisionForm.superclass.initComponent.call(this);this.on("render",function(){if(this.values)this.setData(this.values);else performRPCCall(RPC.Procedure.decisionProcedureLoad,[],{mask:true,wait_text:"\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442\u0441\u044f \u043b\u043e\u0442 \u0434\u043b\u044f \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f \u0438\u0442\u043e\u0433\u043e\u0432"},function(resp){if(resp.success)component.setData(resp.decision_info); else echoResponseMessage(resp)})},this,{single:true})},setData:function(data){var me=this;if(!data){Ext.getCmp(this.ids.button_confirm).setVisible(false);this.add(this.forms.nothing_to_confirm)}else{var lot_data={"lot":data.lot,"suppliers":data.suppliers,"customers":data.customers,"current_customer":data.currentCustomer,"current_supplier":data.currentSupplier,"currency":data.currency};this.add(Application.models.Contract.renderLotInfo(lot_data));this.add(this.forms.contract_confirm);this.add({xtype:"hidden", name:"lot_id",value:data.lot.id});var contract_confirm_fieldset=Ext.getCmp(this.ids.contract_confirm_fieldset);for(var jj in data.customers)if(contract_confirm_fieldset&&data.customers.hasOwnProperty(jj))contract_confirm_fieldset.add(this.createCustomerDecisionsPanel(data.customers[jj]));if(data.lot.select_participant){this.select_participant=true;this.lot_data=data.lot;this.suppliers=data.suppliers;contract_confirm_fieldset.setVisible(false);this.forms.contract_confirm_select.items[1].store=formatSupArray(data.suppliers, data.currency);if(this.forms.contract_confirm_select.items[1].store.length>0)this.forms.contract_confirm_select.items[1].value=this.forms.contract_confirm_select.items[1].store[0][0];if(data.currentSupplier)this.forms.contract_confirm_select.items[1].value=data.currentSupplier;this.add(this.forms.contract_confirm_select);this.add({xtype:"fieldset",title:"\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u043e \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430", items:[{xtype:"Application.components.multiuploadPanel",uploadHandler:RPC.Protocol.update,deleteHandler:RPC.Protocol.deleteProtocol,name:"protocols",simultaneousUpload:false,autoUpload:true,required:false,requiredMark:false,requiredDescr:false,listeners:{beforeupload:function(cmp){cmp.uploadParams.only_file=true;cmp.uploadParams.type_id=50;cmp.uploadParams.lot_id=data.lot.id;cmp.uploadParams.req_id=1;cmp.uploadParams.requirement_id=1},uploadcomplete:function(result,action){if(result.success){me.protocols= me.protocols.concat(result.protocols);me.file=result.file[0]}}}}]})}}if(this.rendered&&this.boxReady)this.doLayout()},getValues:function(){var v={};collectComponentValues(this,v,true);if(isEmpty(v))return null;v.protocols=this.protocols;if(2==v.signatureRequired)v.agreementRequired=0;if(!Ext.isObject(v.requirements[0]))v.requirements=[v.requirements];return v},createCustomerDecisionsPanel:function(customer){var panel_id=Ext.id();return{xtype:"panel",layout:"form",id:panel_id,bodyCssClass:"subpanel-top-padding", style:"margin-bottom: 10px;",frame:true,title:customer.full_name,labelWidth:350,defaults:{anchor:"100%"},name:"requirements",items:[{xtype:"hidden",name:"agreementRequired",value:1},{xtype:"combo",name:"signatureRequired",fieldLabel:"\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430",mode:"local",store:new Ext.data.ArrayStore({id:0,fields:["id","name"],data:[[1,"\u0412 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u0435"], [2,"\u0412 \u043f\u0438\u0441\u044c\u043c\u0435\u043d\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u0435"]]}),editable:false,valueField:"id",displayField:"name",triggerAction:"all",value:1},{xtype:"hidden",name:"customer_id",value:customer.id}],getValues:function(){var panel=Ext.getCmp(panel_id);var values={};collectComponentValues(panel,values,true);return values}}},getSubmitSignatureText:function(params){var component=this;if(params.requirements){var signatureRequired=params.requirements[0].signatureRequired; var agreementRequired=params.requirements[0].agreementRequired}var contract_sign_contragent=component.suppliers.find(function(sup){return sup.id==params.contract_sign_contragent_id})||false;var text="\u041d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u043c \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u044e \u0438\u0442\u043e\u0433\u0438 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b "+component.lot_data.registry_number+":\n\n"+"\u0417\u0430\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0434\u043e\u0433\u043e\u0432\u043e\u0440: "+ ((params.is_contract_sign!==undefined?params.is_contract_sign:component.values.lot.is_contract_sign)?"\u0414\u0430":"\u041d\u0435\u0442")+"\n"+"\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430: "+"\u0432 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u0435"+"\n"+(component.file?"\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442: "+component.file.name+"\n":"")+(contract_sign_contragent?"\u0423\u0447\u0430\u0441\u0442\u043d\u0438\u043a \u0434\u043b\u044f \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430: "+ contract_sign_contragent.short_name:"");return text}});Ext.define("Application.components.ProcedureFullViewPanel",{extend:"Ext.panel.Panel",frame:true,border:false,initComponent:function(){var maincmp=this;this.items=[{xtype:"Application.components.procedureViewPanel",procedure_id:maincmp.procedure_id,listeners:{"dataload":function(procedure){if(procedure.frm==="peretorg")maincmp.setTitle("\u0418\u0437\u0432\u0435\u0449\u0435\u043d\u0438\u0435 \u043e \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0438 \u043f\u0435\u0440\u0435\u0442\u043e\u0440\u0436\u043a\u0438"); if(procedure.private&&isGuest())redirect_to("auth/noaccess");var procedure_status=null;if(Application.models.Procedure.groups.auctions.indexOf(procedure.procedure_type)<0){procedure.offers_step_min=null;procedure.offers_step_max=null;procedure.offers_wait_time=null}if(procedure.procedure_type==PROCEDURE_TYPE_TENDER)delete this.fields.step_is_exact;if(procedure.procedure_type!=Application.models.Procedure.type_ids.contest&&procedure.procedure_type!=Application.models.Procedure.type_ids.quotation&& procedure.procedure_type!=Application.models.Procedure.type_ids.pricelist||!Main.config.peretorg_possible_field)procedure.peretorg_possible=null;if(procedure.price_increase)procedure.procedure_type_vocab+=" \u043d\u0430 \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u0435";if(Application.models.Procedure.groups.auctions.indexOf(procedure.procedure_type)>=0&&Application.models.Procedure.groups.retrades.indexOf(procedure.procedure_type)<0){var auc_subtype=" (\u043e\u0434\u043d\u043e\u044d\u0442\u0430\u043f\u043d\u044b\u0439)"; if(procedure.application_stages==2)auc_subtype=" (\u0434\u0432\u0443\u0445\u044d\u0442\u0430\u043f\u043d\u044b\u0439)";procedure.procedure_type_vocab+=auc_subtype}if(procedure.lots&&procedure.lots[0]){if(procedure.lots[0]["date_published"]){procedure["date_published"]=procedure.lots[0]["date_published"];procedure_status=procedure.lots[0].status}if(procedure_status==10&&procedure.cancel_files.length>0){this.add({xtype:"Application.components.FilelistFieldset",title:"\u0418\u0437\u0432\u0435\u0449\u0435\u043d\u0438\u0435 \u043e\u0431 \u043e\u0442\u043a\u0430\u0437\u0435 \u043e\u0442 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b:", cls:"lot-documents",files:procedure.cancel_files,withHash:false,style:"margin: 5px 5px 0px 5px;"});this.doLayout()}var zipButton=function(files){var filesData=[];Ext.each(files,function(file){filesData.push({id:file.id,name:file.name,hash:file.hash,type:file.type,link:file.link})});return{xtype:"button",text:"\u0421\u043a\u0430\u0447\u0430\u0442\u044c \u0432\u0441\u0435 \u0444\u0430\u0439\u043b\u044b \u0432 \u0432\u0438\u0434\u0435 \u0430\u0440\u0445\u0438\u0432\u0430",hidden:false,handler:function(){var params= {procedure_id:procedure.id,files:Ext.encode(filesData)};performAjaxRPCCall("file/getZip/",params,{download:true,wait_disable:true},echoResponseMessage)}}};if(procedure.common_files.length>0){this.add({xtype:"Application.components.FilelistFieldset",title:"\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b:",cls:"lot-documents",files:procedure.common_files,withHash:false,style:"margin: 5px 5px 0px 5px;",addButtons:[zipButton(procedure.common_files)]}); this.doLayout()}if(procedure.remote_id&&procedure.lots&&procedure.lots[0]){this.add({xtype:"Application.components.FilelistFieldset",title:"\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b:",cls:"lot-documents",files:procedure.lots[0].lot_documentation,withHash:false,style:"margin: 5px 5px 0px 5px;",addButtons:[zipButton(procedure.lots[0].lot_documentation)]});procedure.lots[0].lot_documentation=null;this.doLayout()}}if(!procedure.date_published)if(isCustomer()&& procedure.organizer_contragent_id==Main.contragent.id)Ext.Msg.confirm("\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435","\u041f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430 \u0435\u0449\u0435 \u043d\u0435 \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u0430. \u041f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b?", function(b){if("yes"==b)redirect_to("com/procedure/edit/id/"+procedure.id)});else Ext.Msg.alert("\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435","\u041f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430 \u0435\u0449\u0435 \u043d\u0435 \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u0430, \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b.")}},procedureAutoLoad:true},{xtype:"fieldset",style:"margin: 10px 5px 5px 5px; border-width: 1px;", hidden:true,items:[{html:PREFERENCE925_TEXT}],listeners:{"dataload":function(data){this.setVisible(!!data["preference925_enabled"])}}},{title:"\u0421\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e\u0431 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0442\u043e\u0440\u0435",xtype:"Application.components.keyValue2Panel",autoHeight:true,ref:"organizerInfoCmp",style:"margin: 5px;",listeners:{"dataload":function(data){this.setValues(data,true)}},templates:{org_full_name:'{org_full_name}'}, fields:{"org_full_name":"\u041d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0442\u043e\u0440\u0430:","org_customer_type":"\u0422\u0438\u043f \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0442\u043e\u0440\u0430:","org_main_address":"\u042e\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u0434\u0440\u0435\u0441:","org_postal_address":"\u041f\u043e\u0447\u0442\u043e\u0432\u044b\u0439 \u0430\u0434\u0440\u0435\u0441:", "contact_phone_rendered":"\u041a\u043e\u043d\u0442\u0430\u043a\u0442\u043d\u044b\u0439 \u0442\u0435\u043b\u0435\u0444\u043e\u043d:","contact_fax":"\u0424\u0430\u043a\u0441:","contact_email":"\u0410\u0434\u0440\u0435\u0441 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0447\u0442\u044b:","contact_person":"\u041e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u043b\u0438\u0446\u043e:","review_applics_city":"\u041c\u0435\u0441\u0442\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044f \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0439"}}, {xtype:"panel",title:"\u0421\u043f\u0438\u0441\u043e\u043a \u043b\u043e\u0442\u043e\u0432",frame:false,border:false,style:"margin: 0px 5px 5px 5px; border-width: 1px;",listeners:{"dataload":function(data){if(!data)return;this.getComponent(0).fireEvent("dataload",data)}},items:[{xtype:"tabpanel",autoHeight:true,activeTab:0,id:"lots-list-tabpanel",enableTabScroll:true,resizeTabs:true,minTabWidth:75,frame:true,border:false,bodyCssClass:"x-panel-body",bodyStyle:"padding: 0 5px 10px",items:[],listeners:{"dataload":function(data){var component= this;var lots=data.lots;var lotFields=Application.models.Lot.getLotFields(data.procedure_type);var lotTemplates=Application.models.Lot.getLotTemplates();for(var i=0;i=0||lot.status>2,items:[{xtype:"button",scale:"medium",iconCls:"new-applic24",tooltip:"\u041f\u043e\u0434\u0430\u0442\u044c \u0437\u0430\u044f\u0432\u043a\u0443 \u043d\u0430 \u0443\u0447\u0430\u0441\u0442\u0438\u0435",text:"\u041f\u043e\u0434\u0430\u0442\u044c \u0437\u0430\u044f\u0432\u043a\u0443 \u043d\u0430 \u0443\u0447\u0430\u0441\u0442\u0438\u0435", handler:function(){redirect_to(String.format("com/applic/create/lot/{0}/procedure/"+maincmp.procedure_id,lot.id))}}]}]}})})(i);if(lots.length>0)component.setActiveTab(0);if(!!data["hide_organizer"])maincmp.organizerInfoCmp.hide()}}}]}];var buttons=[];if(undefined!==this.buttons)if(Ext.isArray(this.buttons))buttons.push.apply(buttons,this.buttons);else buttons.push(this.buttons);else if(Main.user.role&&"guest"!==Main.user.role)this.buttons=[{text:"\u0418\u0441\u0442\u043e\u0440\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439", handler:function(){redirect_to("com/procedure/history/procedure/"+maincmp.procedure_id)}}];this.on("beforerender",function(){var procedureViewPanel=this.getComponent(0);this.items.each(function(item,index){if(index==0)return;item.relayEvents(procedureViewPanel,["dataload"])})},this);Application.components.ProcedureFullViewPanel.superclass.initComponent.call(this)}});Ext.define("Application.components.ProcedureGrid",{extend:"Ext.grid.GridPanel",frame:true,border:false,title:"\u041f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b",gridButtons:null,additionalButtons:[],disableAdvancedSearch:false,initComponent:function(){var component=this;var types_combo_id=this.types_combo_id=Ext.id();var procedure_types_combo_id=this.procedure_types_combo_id=Ext.id();var search_toolbar_id=this.search_toolbar_id=Ext.id();var view_applics_separate=false;this.params=this.switchFilters(); if(this.customer_id&&this.customer_id!=false)this.params.customer_id=parseInt(this.customer_id);var store=this.getGridStore(this.params);var statuses=[];var i;statuses.push([-1,"\u0412\u0441\u0435",false]);statuses.push([-2,"\u0410\u043a\u0442\u0438\u0432\u043d\u044b\u0435",false]);statuses.push([-3,"\u041e\u0436\u0438\u0434\u0430\u044e\u0449\u0438\u0435 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043d\u0430 \u0415\u0418\u0421",false]);for(i=0;i<16;i++)if(!isEmpty(Application.models.Procedure.statuses[i])){var disabled= false;if(!isCustomer()&&!isAdmin()&&i>=0&&i<2)disabled=true;statuses.push([i,Application.models.Procedure.statuses[i],disabled])}var statuses_lot=[];statuses_lot.push([-1,"\u0412\u0441\u0435",false]);for(i=0;i<11;i++)statuses_lot.push([i,Application.models.Lot.statuses[i],false]);var types=[];types.push([0,"\u0412\u0441\u0435"]);for(i=0;i",{text:"\u0417\u0430\u043a\u0440\u044b\u0442\u044c",handler:function(){wnd.close()}}]});wnd.show()},showProcedureAccess:function(record, lot){var accessWindow=new Ext.Window({closeAction:"close",width:800,modal:true,height:400,layout:"fit",title:"\u0416\u0443\u0440\u043d\u0430\u043b \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435 "+record.data.registry_number+" \u041b\u043e\u0442 \u2116"+record.data.lots[lot].number,items:[{xtype:"Application.components.procedureAccessLogGrid",lot_id:record.data.lots[lot].id}],buttons:[{text:"\u0417\u0430\u043a\u0440\u044b\u0442\u044c",handler:function(){accessWindow.close()}}]}); accessWindow.show()},showOffers:function(record,lot){var eventWindow=new Ext.Window({closeAction:"close",width:800,height:400,layout:"fit",title:"\u0425\u043e\u0434 \u0442\u043e\u0440\u0433\u043e\u0432 \u043f\u043e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435 "+record.data.registry_number+" \u041b\u043e\u0442 \u2116"+record.data.lots[lot].number,items:[{xtype:"Application.components.OffersGrid",lot_id:record.data.lots[lot].id,procedure_data:record.data,height:369}]});eventWindow.show()}, showOOSEvents:function(record){var eventWindow=new Ext.Window({closeAction:"close",width:800,height:400,layout:"fit",modal:true,maximizable:true,title:"\u0412\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u0415\u0418\u0421 \u043f\u043e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435 "+(record.data.registry_number||""),items:[{xtype:"Application.components.OosGrid",filter_key:"procedure_id",filter_value:record.id,procedure_organizer:record.data.organizer_contragent_id, height:369}]});eventWindow.show()},showRegnumForm:function(record,grid,is_customer){var winId=Ext.id(),frmId=Ext.id();var date_last_edited=parseDate(record.data.date_last_edited);if(date_last_edited)date_last_edited=date_last_edited.format("d.m.Y");var eventWindow=new Ext.Window({closeAction:"close",width:550,height:160,resizable:false,modal:true,layout:"fit",id:winId,title:"\u041f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044f"+(!Ext.isEmpty(record.data.registry_number)?" \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u043e\u0442 "+ date_last_edited:""),items:[{xtype:"form",id:frmId,frame:true,border:false,labelWidth:250,padding:"10px 5px 5px 5px",items:[{xtype:"fieldset",items:[{xtype:"textfield",name:"registry_number",readOnly:is_customer,cls:is_customer||!Ext.isEmpty(record.data.registry_number)?"readonly":null,anchor:"100%",value:!Ext.isEmpty(record.data.registry_number)?record.data.registry_number:"",fieldLabel:"\u0420\u0435\u0435\u0441\u0442\u0440\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440, \u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d\u043d\u044b\u0439 \u043d\u0430 \u0415\u0418\u0421"+ REQUIRED_FIELD},{fieldLabel:"\u0414\u0430\u0442\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b"+REQUIRED_FIELD,xtype:"Application.components.dateField",format:"d.m.Y",anchor:"100%",altFormats:"c|d.m.Y H:i:s|d.m.Y H:i",readOnly:!Ext.isEmpty(record.data.registry_number),cls:is_customer||!Ext.isEmpty(record.data.registry_number)?"readonly":null,name:"date_published",width:200,value:record.data.date_published}]}],buttons:[{text:"\u041e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u0442\u044c", handler:function(){var values=Ext.getCmp(frmId).getForm().getValues();values.procedure_id=record.data.id;var confirm="";if(is_customer){values.is_customer=1;confirm="\u0412\u041d\u0418\u041c\u0410\u041d\u0418\u0415! \u0414\u0430\u043d\u043d\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0434\u043b\u044f \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439, \u043d\u0435 \u0434\u043e\u0436\u0438\u0434\u0430\u044f\u0441\u044c \u0441\u0443\u0442\u043e\u0447\u043d\u043e\u0439 \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0441 zakupki.gov.ru. "+ "\u0424\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0432 \u0441\u0443\u0442\u043a\u0438. \u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f, \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u041f\u0440\u043e\u0435\u043a\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d \u043d\u0430 zakupki.gov.ru, \u0447\u0442\u043e \u0432\u044b \u0435\u0433\u043e \u0442\u0430\u043c \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043b\u0438, "+ "\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043d\u0430 zakupki.gov.ru \u0443\u0436\u0435 \u0432\u0441\u0442\u0443\u043f\u0438\u043b\u0438 \u0432 \u0441\u0438\u043b\u0443. \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0441\u0442\u044c \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u043d\u0430 zakupki.gov.ru \u043c\u043e\u0436\u043d\u043e \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u00ab\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u0438\u00bb - \u00ab\u0412\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u0415\u0418\u0421\u00bb \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440. "+ "\u0412\u043e\u0438\u0437\u0431\u0435\u0436\u0430\u043d\u0438\u0435 \u0440\u0430\u0441\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0438 \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 zakupki.gov.ru, \u041f\u0440\u043e\u0435\u043a\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d \u0412\u0430\u043c\u0438 \u0432 \u041b\u041a \u043d\u0430 \u0415\u0418\u0421 \u0432 \u0442\u0435\u043a\u0443\u0449\u0438\u0435 \u0441\u0443\u0442\u043a\u0438. \u0412 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u043e\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0435\u043b\u044c\u0437\u044f. "+ "\u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0440\u0430\u0441\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u041f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0438 \u043d\u0430 \u0415\u0418\u0421 \u0438\u0437-\u0437\u0430 \u043d\u0435\u0441\u0432\u043e\u0435\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0432 \u043b\u0438\u0447\u043d\u043e\u043c \u043a\u0430\u0431\u0438\u043d\u0435\u0442\u0435 \u043d\u0430 \u0415\u0418\u0421, \u0432 \u0445\u043e\u0434\u0435 \u0441\u0443\u0442\u043e\u0447\u043d\u043e\u0439 \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u0438\u043d\u044f\u0442\u044b \u0434\u0430\u043d\u043d\u044b\u0435, "+ "\u043f\u043e\u0441\u0442\u0443\u043f\u0438\u0432\u0448\u0438\u0435 \u0441 \u0415\u0418\u0421, \u0430 \u043d\u0435\u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0442\u0430\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0443\u0442 \u043e\u0442\u043c\u0435\u043d\u0435\u043d\u044b. \u0412\u044b \u0443\u0432\u0435\u0440\u0435\u043d\u044b, \u0447\u0442\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044e?"}else confirm= "\u0412\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443, \u043d\u0435 \u0434\u043e\u0436\u0438\u0434\u0430\u044f\u0441\u044c \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043e\u0442 \u0415\u0418\u0421?"; performRPCCall(RPC.Procedure.forcepublish,[values],{wait_text:"\u0418\u0434\u0435\u0442 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044f...",confirm:confirm},function(result){if(result.success){echoResponseMessage(result);grid.getStore().reload();Ext.getCmp(winId).close()}else echoResponseMessage(result)})}}]}]});eventWindow.show()},searchHelp:function(){if(!this.help_search_window)this.help_search_window=new Ext.Window({width:750,height:350,layout:"fit",title:"\u0421\u043f\u0440\u0430\u0432\u043a\u0430 \u043f\u043e \u043f\u043e\u0438\u0441\u043a\u0443", closeAction:"hide",bodyStyle:"padding: 5px;",autoScroll:true,autoHeight:true,plain:true,cls:"x-panel-mc",plugins:["LimitSize"],items:[{border:false,html:'
\u0414\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u043f\u043e\u0438\u0441\u043a\u0430 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u043c \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u0441\u043e\u0432\u0435\u0442\u0430\u043c\u0438:
    '+ "
  • \u043f\u043e\u0438\u0441\u043a \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u043c\u043e\u0440\u0444\u043e\u043b\u043e\u0433\u0438\u0438. \u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u0441\u043b\u043e\u0432\u043e\u0444\u043e\u0440\u043c\u044b (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u0438\u0441\u043a \u043f\u043e \u0441\u043b\u043e\u0432\u0443 \u00ab\u043f\u043e\u0441\u0442\u0430\u0432\u043a\u0430\u00bb \u043d\u0430\u0439\u0434\u0435\u0442 \u0438 \u00ab\u043f\u043e\u0441\u0442\u0430\u0432\u043a\u0438\u00bb \u0438 \u00ab\u043f\u043e\u0441\u0442\u0430\u0432\u043a\u0443\u00bb, \u043d\u043e \u043f\u043e \u0441\u043b\u043e\u0432\u0443 \u00ab\u043f\u043e\u0441\u0442\u0430\u0432\u00bb \u044d\u0442\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u043d\u0430\u0439\u0434\u0435\u043d\u044b, \u0442.\u043a. \u044d\u0442\u043e \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u0435 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u044c\u044e \u0441\u043b\u043e\u0432\u0430.);
  • "+ "
  • \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043e\u0434\u043d\u043e\u043a\u043e\u0440\u0435\u043d\u043d\u044b\u0435 \u0441\u043b\u043e\u0432\u0430 \u043c\u043e\u0433\u0443\u0442 \u0441\u0447\u0438\u0442\u0430\u0442\u044c\u0441\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u043f\u0440\u0438 \u043f\u043e\u0438\u0441\u043a\u0435, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u0438\u0441\u043a \u043f\u043e \u00ab\u0434\u0438\u0437\u0435\u043b\u044c\u00bb \u043d\u0430\u0439\u0434\u0435\u0442 \u00ab\u0434\u0438\u0437\u0435\u043b\u044f\u00bb, \u00ab\u0434\u0438\u0437\u0435\u043b\u0435\u0439\u00bb. \u0410 \u043f\u043e \u00ab\u0434\u0438\u0437\u0435\u043b\u044c\u043d\u044b\u0439\u00bb \u043d\u0430\u0439\u0434\u0443\u0442\u0441\u044f \u00ab\u0434\u0438\u0437\u0435\u043b\u044c\u043d\u043e\u0433\u043e\u00bb, \u00ab\u0434\u0438\u0437\u0435\u043b\u044c\u043d\u044b\u043c\u00bb, \u043d\u043e \u043d\u0435 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442;
  • "+ "
  • \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0439\u0442\u0438 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443, \u0432 \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0435\u0441\u0442\u044c \u0441\u0440\u0430\u0437\u0443 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438\u0441\u043a\u043e\u043c\u044b\u0445 \u0441\u043b\u043e\u0432, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u044d\u0442\u0438 \u0441\u043b\u043e\u0432\u0430 \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0431\u0435\u043b (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u0438\u0441\u043a \u043f\u043e \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u044e \u00ab\u043f\u043e\u0441\u0442\u0430\u0432\u043a\u0430 \u0442\u043e\u043f\u043b\u0438\u0432\u043e\u00bb \u043d\u0430\u0439\u0434\u0435\u0442 \u0438 \u00ab\u2026\u043f\u043e\u0441\u0442\u0430\u0432\u043a\u0430 \u0430\u0432\u0442\u043e\u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u0442\u043e\u043f\u043b\u0438\u0432\u0430\u2026\u00bb \u0438 \u00ab\u2026\u043d\u0430 \u043f\u043e\u0441\u0442\u0430\u0432\u043a\u0443 \u0434\u0438\u0437\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0442\u043e\u043f\u043b\u0438\u0432\u0430\u2026\u00bb \u0438 \u0442.\u043f., \u043f\u0440\u0438\u0447\u0435\u043c \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0438 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u043b\u043e\u0432 \u043d\u0435 \u0432\u0430\u0436\u043d\u043e);
  • "+ "
  • \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0439\u0442\u0438 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443, \u0432 \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0435\u0441\u0442\u044c \u0445\u043e\u0442\u044f \u0431\u044b \u043e\u0434\u043d\u043e \u0438\u0437 \u0438\u0441\u043a\u043e\u043c\u044b\u0445 \u0441\u043b\u043e\u0432, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u044d\u0442\u0438 \u0441\u043b\u043e\u0432\u0430 \u0447\u0435\u0440\u0435\u0437 \u0437\u0430\u043f\u044f\u0442\u0443\u044e (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u0438\u0441\u043a \u043f\u043e \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u044e \u00ab\u043f\u043e\u0441\u0442\u0430\u0432\u043a\u0430, \u0442\u043e\u043f\u043b\u0438\u0432\u043e\u00bb \u043d\u0430\u0439\u0434\u0435\u0442 \u0438 \u00ab\u043f\u043e\u0441\u0442\u0430\u0432\u043a\u0430 \u043c\u0430\u0441\u043b\u0430\u00bb \u0438 \u00ab\u0434\u0438\u0437\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0442\u043e\u043f\u043b\u0438\u0432\u0430\u00bb \u0438 \u0442.\u043f.);
  • "+ "
  • \u0434\u043b\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0438\u0437 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440, \u0432 \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0435\u0441\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0441\u043b\u043e\u0432\u0430, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u044d\u0442\u0438 \u0441\u043b\u043e\u0432\u0430 \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435, \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0432 \u0438\u0445 \u0432\u043e\u0441\u043a\u043b\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0437\u043d\u0430\u043a\u043e\u043c (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u0438\u0441\u043a \u043f\u043e \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u044e \u00ab\u043f\u043e\u0441\u0442\u0430\u0432\u043a\u0430 \u0442\u043e\u043f\u043b\u0438\u0432\u043e !\u0431\u0435\u043d\u0437\u0438\u043d\u00bb \u043d\u0430\u0439\u0434\u0435\u0442 \u00ab\u043f\u043e\u0441\u0442\u0430\u0432\u043a\u0430 \u0434\u0438\u0437\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0442\u043e\u043f\u043b\u0438\u0432\u0430\u00bb, \u043d\u043e \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u0442 \u00ab\u043f\u043e\u0441\u0442\u0430\u0432\u043a\u0430 \u0442\u043e\u043f\u043b\u0438\u0432\u0430 (\u0431\u0435\u043d\u0437\u0438\u043d\u0430)\u00bb);
  • "+ "
  • \u0434\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u043a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b, \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u044f \u0447\u0430\u0441\u0442\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 \u0441\u043a\u043e\u0431\u043a\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u0438\u0441\u043a \u043f\u043e \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u044e \u00ab(\u043f\u043e\u0441\u0442\u0430\u0432\u043a\u0430, \u0437\u0430\u043f\u0440\u0430\u0432\u043a\u0430) (\u0442\u043e\u043f\u043b\u0438\u0432\u043e, \u0431\u0435\u043d\u0437\u0438\u043d)\u00bb \u043d\u0430\u0439\u0434\u0435\u0442 \u0438 \u00ab\u043f\u043e\u0441\u0442\u0430\u0432\u043a\u0438 \u0431\u0435\u043d\u0437\u0438\u043d\u0430\u00bb, \u0438 \u00ab\u0437\u0430\u043f\u0440\u0430\u0432\u043a\u0443 \u0430\u0432\u0442\u043e\u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u043c \u0431\u0435\u043d\u0437\u0438\u043d\u043e\u043c\u00bb, \u0438 \u00ab\u0442\u043e\u043f\u043b\u0438\u0432\u043e \u043d\u0430 \u043f\u043e\u0441\u0442\u0430\u0432\u043a\u0443\u00bb \u0438 \u0442.\u043f.);
  • "+ "
  • \u0437\u043d\u0430\u043a\u0438 \u043f\u0440\u0435\u043f\u0438\u043d\u0430\u043d\u0438\u044f \u043f\u0440\u0438 \u043f\u043e\u0438\u0441\u043a\u0435 \u043d\u0435 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0445 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0432 \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0435 (\u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0438\u043c\u0435\u044e\u0449\u0438\u0445 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0445 \u0432\u044b\u0448\u0435). \u041f\u0440\u0435\u0434\u043b\u043e\u0433\u0438 \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445 \u0442\u0430\u043a\u0436\u0435 \u043d\u0435 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f, \u0438 \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0442\u044c;
  • "+ "
  • \u0440\u0435\u0433\u0438\u0441\u0442\u0440 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u043d\u0435 \u0432\u0430\u0436\u0435\u043d (\u0437\u0430\u043f\u0440\u043e\u0441\u044b \u00ab\u0411\u0415\u041d\u0417\u0418\u041d\u00bb \u0438 \u00ab\u0431\u0435\u043d\u0437\u0438\u043d\u00bb \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u044b \u0438 \u043e\u0431\u0430 \u043d\u0430\u0439\u0434\u0443\u0442 \u0434\u0430\u0436\u0435 \u00ab\u0431\u0415\u043d\u0417\u0438\u041d\u00bb);
  • "+"
  • \u0447\u0430\u0441\u0442\u0438 \u0441\u043b\u043e\u0432, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0447\u0435\u0440\u0435\u0437 \u0434\u0435\u0444\u0438\u0441, \u0441\u0447\u0438\u0442\u0430\u044e\u0442\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u0438\u0441\u043a \u043f\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0443 \u00ab\u0433\u043e\u0440\u044e\u0447\u0435\u0435\u00bb \u043d\u0430\u0439\u0434\u0435\u0442 \u00ab\u0433\u043e\u0440\u044e\u0447\u0435-\u0441\u043c\u0430\u0437\u043e\u0447\u043d\u044b\u0435\u00bb).
  • "+ "
"+"
\u0415\u0441\u043b\u0438 \u043f\u043e\u0438\u0441\u043a \u043d\u0435 \u0434\u0430\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432, \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u043b\u043e\u0432\u0430 \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u043d\u0430 \u0441\u0438\u043d\u043e\u043d\u0438\u043c\u044b \u0438\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u044b\u0435 \u0441\u043b\u043e\u0432\u043e\u0444\u043e\u0440\u043c\u044b. "+ "\u0422\u0430\u043a\u0436\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u043e\u0438\u0441\u043a\u0430 \u0431\u0443\u0434\u0443\u0442 \u043f\u0443\u0441\u0442\u044b \u043f\u0440\u0438 \u043e\u0448\u0438\u0431\u043a\u0430\u0445 \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u0438 \u043d\u0435\u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u043d\u043e\u0441\u0442\u0438 \u0441\u043a\u043e\u0431\u043e\u043a).
"}], buttonAlign:"center",buttons:[{text:"\u0417\u0430\u043a\u0440\u044b\u0442\u044c",handler:function(){this.help_search_window.hide()},scope:this}]});this.help_search_window.show()},isAllOf:function(v,m,r){if(this.tooltip=="\u041f\u043e\u0434\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u044f\u0432\u043a\u0438"){var isOrganizer;if(undefined!==Main.contragent)isOrganizer=r.data.organizer_contragent_id==Main.contragent.id;if(isCustomer()&&r.data.procedure_type==PROCEDURE_TYPE_QUOTATION_REQ&&isOrganizer&& r.json.is_applics_view)return false;if(Main.user&&Main.user.allow_view_apps)return false}if(typeof this.isHiddenInLot=="function")for(var i=0;i=0&&r.data.id<2||r.data.id>=0&&type&&type.statuses&&type.statuses.indexOf(r.data.id)<0)r.data.disabled=true;r.endEdit()});this.statuses_store.fireEvent("datachanged",this.statuses_store);if(this.statuses_store.getById(value).data.disabled)value=-1;stat_combo.setValue(value)}}},{xtype:"Application.components.numberinterval",intervalType:"Field",name:"start_price",width:150,fieldLabel:"\u041d\u0430\u0447\u0430\u043b\u044c\u043d\u0430\u044f \u0446\u0435\u043d\u0430",allowNegative:false,fromText:"\u043e\u0442", tillText:"\u0434\u043e",decimalSeparator:"",decimalPrecision:0,listeners:{blur:function(field){var value=field.getValue(value);if(!isNaN(value))if("start_price_from"===this.name){var to_field=Ext.query("[name=start_price_till]")[0];var maxValue=parseInt(to_field.value);if(!isNaN(maxValue))field.maxValue=maxValue}else if("start_price_till"===this.name){var from_field=Ext.query("[name=start_price_from]")[0];var minValue=parseInt(from_field.value);if(!isNaN(minValue))field.minValue=minValue}this.validate()}}}, {xtype:"checkbox",name:"peretorg_possible",fieldLabel:"\u0424\u043b\u0430\u0433 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0435\u0440\u0435\u0442\u043e\u0440\u0436\u043a\u0438"},{xtype:"dateinterval",name:"date_begin_auction",width:150,fieldLabel:"\u041f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0442\u043e\u0440\u0433\u043e\u0432"},{xtype:"Application.components.combo",editable:false,width:200,mode:"local",fieldLabel:"\u0421\u0442\u0430\u0442\u0443\u0441 \u043b\u043e\u0442\u0430", name:"status_lot",triggerAction:"all",displayField:"status",disabledField:"disabled",valueField:"id",value:-1,store:this.statuses_lot_store,hidden:true},{xtype:"Application.components.percentinterval",intervalType:"Field",name:"guarantee_application",width:150,fieldLabel:"\u0420\u0430\u0437\u043c\u0435\u0440 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0437\u0430\u044f\u0432\u043a\u0438 \u043f\u043e \u043b\u043e\u0442\u0443",fromText:"\u043e\u0442",tillText:"\u0434\u043e"}, {xtype:"Application.components.combo",id:this.types_combo_id,editable:false,width:200,mode:"local",fieldLabel:"\u0421\u0442\u0430\u0442\u0443\u0441 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440",name:"status",triggerAction:"all",displayField:"status",disabledField:"disabled",valueField:"id",value:-1,store:this.statuses_store,minListWidth:300},{xtype:"dateinterval",name:"date_published",width:150,fieldLabel:"\u0414\u0430\u0442\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b"}, {xtype:"textfield",name:"organizer",fieldLabel:"\u041e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0442\u043e\u0440",hidden:!isSupplier()&&isCustomer(),defaultValue:""},{xtype:"Application.components.numberinterval",intervalType:"Field",name:"counts_application_by_lot",width:150,fieldLabel:"\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u044f\u0432\u043e\u043a \u043f\u043e \u043b\u043e\u0442\u0443",allowNegative:false,fromText:"\u043e\u0442",tillText:"\u0434\u043e",decimalSeparator:"", decimalPrecision:0,listeners:{blur:function(field){var value=field.getValue(value);if(!isNaN(value))if("counts_application_by_lot_from"===this.name){var to_field=Ext.query("[name=counts_application_by_lot_till]")[0];var maxValue=parseInt(to_field.value);if(!isNaN(maxValue))field.maxValue=maxValue}else if("counts_application_by_lot_till"===this.name){var from_field=Ext.query("[name=counts_application_by_lot_from]")[0];var minValue=parseInt(from_field.value);if(!isNaN(minValue))field.minValue=minValue}this.validate()}}}, {xtype:"Application.components.combo",editable:false,width:200,mode:"local",fieldLabel:"\u0420\u0435\u0433\u0438\u043e\u043d \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0442\u043e\u0440\u0430",name:"organizer_region",triggerAction:"all",displayField:"name",valueField:"name",minListWidth:300,value:"\u0412\u0441\u0435",store:createRegionsStore()},{xtype:"checkbox",name:"coordination_resolved",boxLabel:"\u0421\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u043a\u0443\u043f\u043a\u0438", fieldLabel:"",labelSeparator:"",hidden:!Main.config.procedure_coordination||Main&&Main.user&&Main.user.department_role_id!=DEPARTMENT_ROLE_HEAD,disabled:!Main.config.procedure_coordination||Main&&Main.user&&Main.user.department_role_id!=DEPARTMENT_ROLE_HEAD},{xtype:"combo",store:createCompanyStore(false,false),name:"customer_id",mode:"remote",fieldLabel:"\u0417\u0430\u043a\u0430\u0437\u0447\u0438\u043a",valueField:"id",displayField:"full_name",tpl:new Ext.XTemplate('
', "{full_name}","
"),itemSelector:"div.search-item",allowBlank:true,minChars:3,pageSize:10,hideTrigger:true,forceSelection:true,triggerAction:"all",defaultValue:"",listeners:{afterrender:function(){if(this.value){var val=this.value;var record=this.getStore().getById(val);if(!record){var cmp=this;this.getStore().on("load",function(){cmp.setValue(val)},this,{single:true});this.initQuery();return false}}}}},{xtype:"Application.components.combo",fieldLabel:"\u0412\u0430\u043b\u044e\u0442\u0430 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430", store:getCurrencyStore("procedure_list_currency",true),valueField:"id",displayField:"description",name:"currency",hiddenName:"currency_val",value:this.value?this.value.currency:0,mode:"local",editable:false,triggerAction:"all",renderer:function(values){return Ext.util.Format.countryFlag(values.alpha2||values.alpha3)+" "+values.description},listeners:{beforerender:function(){var st=this.getStore();st.on("load",function(){this.setValue(this.value)},this,{once:true})}}},{xtype:"textfield",name:"customer_inn", fieldLabel:"\u0418\u041d\u041d \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u0430 \u043b\u043e\u0442\u0430",defaultValue:""},{xtype:"Application.components.priceinterval",intervalType:"Field",name:"",width:150,fieldLabel:"\u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430",allowNegative:false,fromText:"\u043a\u043e\u0434",tillText:"\u043a\u043e\u0434", hidden:true},{xtype:"Application.components.combo",editable:false,width:200,mode:"local",name:"customer_region",fieldLabel:"\u0420\u0435\u0433\u0438\u043e\u043d \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u0430 \u043b\u043e\u0442\u0430",triggerAction:"all",minListWidth:300,displayField:"name",valueField:"name",value:"\u0412\u0441\u0435",store:createRegionsStore()},{xtype:"combo",name:"department_id",valueField:"id",displayField:"name",fieldLabel:"\u041e\u0442\u0434\u0435\u043b",mode:"local", store:createDepartmentsStore(),editable:false,triggerAction:"all",hidden:!Main.config.departments||Main&&Main.user&&Main.user.department_role_id!=DEPARTMENT_ROLE_HEAD,listeners:{render:function(){if(Main.config.departments&&Main&&Main.user&&Main.user.department_role_id==DEPARTMENT_ROLE_HEAD){var store=this.getStore();store.load()}}}},{xtype:"combo",editable:false,fieldLabel:"\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043b\u044c",mode:"local",name:"representatives_combo_box", triggerAction:"all",displayField:"full_name",valueField:"id",store:this.representatives_store,hidden:!this.params.representative||!isCustomer(),stateful:true,listeners:{scope:this,afterrender:function(){if(!(!this.params.representative||!isCustomer())){var combo=this;var store=this.getStore();store.load({callback:function(){var value=combo.getValue();if(!value){var recordSelected=combo.getStore().getAt(0);value=recordSelected.get("id")}combo.setValue(value)}})}}}},{xtype:"checkbox",name:"middle_small_business", fieldLabel:"\u0414\u043b\u044f \u0441\u0443\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043c\u0430\u043b\u043e\u0433\u043e \u0438 \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u043f\u0440\u0435\u0434\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430",hidden:!Main.config.middle_small_business},{xtype:"textfield",name:"contract_registry_number",fieldLabel:"\u041d\u043e\u043c\u0435\u0440 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430",defaultValue:"",hidden:this.filter&& this.filter.indexOf("contract")<0},{xtype:"combo",store:createCompanyStore(false,false),name:"one_of_suppliers_id",mode:"remote",fieldLabel:"\u0423\u0447\u0430\u0441\u0442\u043d\u0438\u043a \u043b\u043e\u0442\u0430",valueField:"id",displayField:"full_name",hidden:!isAdmin(),tpl:new Ext.XTemplate('
',"{full_name}","
"),itemSelector:"div.search-item",allowBlank:true,minChars:3,pageSize:10,hideTrigger:true, forceSelection:true,triggerAction:"all",defaultValue:"",listeners:{afterrender:function(){if(this.value){var val=this.value;var record=this.getStore().getById(val);if(!record){var cmp=this;this.getStore().on("load",function(){cmp.setValue(val)},this,{single:true});this.initQuery();return false}}}}}];return{xtype:"Application.components.searchToolbar",id:this.search_toolbar_id,advancedSearch:advancedSearchElements,searchTools:[{id:"help",align:"left",handler:this.searchHelp,tip:"\u0421\u043f\u0440\u0430\u0432\u043a\u0430 \u043f\u043e \u043f\u043e\u0438\u0441\u043a\u0443", scope:this}],eventTarget:this,listeners:{scope:this,afterrender:function(){if(isEmpty(advancedSearchElements))return}}}},showProcedureGrantAccess:function(record){var proc_grant_access_id=Ext.id();var eventWindow=new Ext.Window({closeAction:"close",width:800,height:500,title:"\u0414\u043e\u0441\u0442\u0443\u043f \u043a \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435 "+record.data.registry_number,modal:true,layout:"fit",items:[{xtype:"Application.components.GrantAccessGrid",proc_id:record.data.id, grid_only:true,id:proc_grant_access_id}],buttons:[{text:"\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c",handler:function(){var tmp_arr=new Array;var arr=new Object;var proc_id=record.data.id;var i;data_arr=eventWindow.grid.getStore();for(i=0;i-1;if(Main.user.contragent_id!=winner&&!isCustomer()&&!isAdmin()&&!is_additional_supplier)return true;if(status==COORDINATION_STATUS_DECLINED&&Main.user.contragent_id==winner)return false;if(status==COORDINATION_STATUS_SUPPLIERS_COORDINATION&&is_additional_supplier)return false;if(Main.user.contragent_id!=r.data.organizer_contragent_id&&!in_array(Main.user.contragent_id, r.data.lots[0].customer_ids))return true;if(status==COORDINATION_STATUS_COORDINATION&&(isCustomer()||isAdmin()))return false;else return true}else return true},getContractDocCustomerStatusTitle:function(v,m,r){var lotData=r.data.lots["0"];if(lotData["contract_documents_pending"]<1)return"";return"\u041d\u043e\u0432\u044b\u0445 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432: "+lotData["contract_documents_pending"]},getContractDocSupplierStatusTitle:function(v, m,r){var lotData=r.data.lots["0"];if(lotData["contract_documents_status"]===CONTRACT_DOCUMENTS_STATUS_DEJECTED)return"\u041a\u043e\u043c\u043f\u043b\u0435\u043a\u0442 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d";if(lotData["contract_documents_status"]===CONTRACT_DOCUMENTS_STATUS_RESOLVED);},getContractDocStatusTitle:function(v,m,r){var lotData=r.data.lots["0"];if(lotData["contract_suppliers"]&&lotData["contract_suppliers"][0]&&lotData["contract_suppliers"][0]["id"]== Main.contragent.id){var status=lotData["contract_suppliers"][0]["doc_contract_status"];var status_contragent_id=Main.contragent.id}else{var status=lotData["doc_contract_status"];var status_contragent_id=lotData["contract_supplier_id"]}if(isSupplier()&&status_contragent_id==Main.user.contragent_id){if(status===COORDINATION_STATUS_DECLINED)return"\u041e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u044b \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b";return}if(isAdmin()||in_array(Main.user.contragent_id, r.data.lots["0"].customer_ids)){if(status===COORDINATION_STATUS_COORDINATION)return"\u041d\u043e\u0432\u044b\u0439 \u043f\u0430\u043a\u0435\u0442 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432";return}var is_additional_supplier=r.data.lots["0"]["contract_additional_suppliers"]&&r.data.lots["0"]["contract_additional_suppliers"].indexOf(Main.user.contragent_id)>-1;if(r.data.lots["0"].doc_contract_status==5&&is_additional_supplier)return"\u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0442\u0430"}});Ext.define("Application.components.ProcedureInnerClassificationPanel",{extend:"Ext.form.FieldSet",initComponent:function(){var component=this;var tree_id=Ext.id();var cc_current=Ext.id();var text_empty=Ext.id();this.addEvents("nomenclatureselected");Ext.apply(this,{layout:"form",anchor:"100%",defaults:{anchor:"100%",allowBlank:false},autoHeight:true,frame:false,labelWidth:200,items:[{xtype:"panel",border:false,id:cc_current,items:[{id:text_empty,bodyCssClass:"subpanel",cls:"spaced-panel",hidden:true, html:"\u041a\u043e\u0434 \u043d\u0435 \u0432\u044b\u0431\u0440\u0430\u043d"}],listeners:{afterrender:function(){component.emptyTextShow();component.doLayout()}}}],buttons:[{text:"\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c",handler:function(){var win=new Ext.Window({title:"\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u0434\u0430",width:700,height:400,bodyStyle:"padding: 10px",layout:"fit",items:[{id:tree_id,xtype:"Application.components.nomenclatureTree",type:"procedure_inner_classification", selection:this.selection,listeners:{nomenclature_selected:function(n){n.code_id=n.id;delete n.id;component.fireEvent("nomenclatureselected",n);win.close()}}}],buttons:[{xtype:"button",text:"\u0412\u044b\u0431\u0440\u0430\u0442\u044c",handler:function(){var n=Ext.getCmp(tree_id).getSelectedObject();var txt=false;if(!n)txt="\u0412\u044b \u043d\u0435 \u0432\u044b\u0431\u0440\u0430\u043b\u0438 \u043a\u043e\u0434!";else if(!n.leaf)txt="\u0421\u043b\u0435\u0434\u0443\u0435\u0442 \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c \u043a\u043e\u0434, \u0430 \u043d\u0435 \u0446\u0435\u043b\u044b\u0439 \u0440\u0430\u0437\u0434\u0435\u043b"; if(txt)Ext.Msg.alert("\u041e\u0448\u0438\u0431\u043a\u0430",txt);else{n.code_id=n.id;delete n.id;component.fireEvent("nomenclatureselected",n);win.close()}}},{text:"\u0417\u0430\u043a\u0440\u044b\u0442\u044c",handler:function(){win.close()}}]});win.show()}}],listeners:{nomenclatureselected:function(n){component.addCategory(n);component.emptyTextShow();component.doLayout()}},emptyTextShow:function(){var cmp_cc=Ext.getCmp(cc_current);var cmp_te=Ext.getCmp(text_empty);if(cmp_cc.items.length==1)cmp_te.setVisible(true); else cmp_te.setVisible(false)},addCategory:function(n){var cc_panel=Ext.getCmp(cc_current);cc_panel.add({layout:"column",cls:"spaced-panel",bodyCssClass:"subpanel",border:true,items:[{columnWidth:1,xtype:"panel",layout:"form",border:false,hideTitle:true,cls:"spaced-cell",html:n.full_name},{xtype:"button",text:"\u0423\u0434\u0430\u043b\u0438\u0442\u044c",cls:"spaced-cell",handler:function(){var p=this.findParentByType("panel");var cur_cat=p.getValue();Ext.Msg.confirm("\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435", "\u0412\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u044d\u0442\u0443 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044e '"+cur_cat.name+"'?",function(b){if("yes"==b){p.destroy();component.emptyTextShow()}})}}],procedure_codes:{id:n.id,code_id:n.code_id,name:n.text,full_name:n.full_name,path:n.path},name:"procedure_inner_classification[]",getValue:function(){return this.procedure_codes}})}, removeAllCategories:function(){var cmp_cc=Ext.getCmp(cc_current);var cmp_te=Ext.getCmp(text_empty);cmp_cc.items.each(function(val){if(val.getId()!=cmp_te.getId())val.destroy()})},setValues:function(val){if(val){component.removeAllCategories();for(var prop in val)if(val.hasOwnProperty(prop))component.addCategory(val[prop]);component.emptyTextShow();component.doLayout()}}});Application.components.ProcedureInnerClassificationPanel.superclass.initComponent.call(this)}});Ext.define("Application.components.ProcedureInvitesForm",{extend:"Ext.form.Panel",frame:true,autoHeight:true,initComponent:function(){var component=this;this.addEvents("load_invite_text");var categories_panel_id=Ext.id();var invite_subject_id=Ext.id();var invite_body_id=Ext.id();var procedure_selection_grid_id=Ext.id();Ext.apply(this,{labelWidth:150,defaults:{anchor:"100%"},bodyCssClass:"subpanel-top-padding",items:[{xtype:"fieldset",title:"\u041f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b", items:[{xtype:"Application.components.ProcedureSelectionGrid",id:procedure_selection_grid_id,procedure_id:component.procedure_id}]},{xtype:"fieldset",title:"\u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f",defaults:{anchor:"100%"},items:[{xtype:"textfield",fieldLabel:"\u0422\u0435\u043c\u0430 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f",id:invite_subject_id,name:"subject"},{xtype:"textarea",fieldLabel:"\u0422\u0435\u043a\u0441\u0442 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f", id:invite_body_id,height:200,name:"message_text"}]},{xtype:"fieldset",title:"\u0421\u0444\u0435\u0440\u044b \u0434\u0435\u044f\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u0435\u0439",items:[{xtype:"Application.components.CompanyCategoriesPanel",optype:"choice",id:categories_panel_id}]}],buttons:[{text:"\u041e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f",handler:function(){var subject_field= Ext.getCmp(invite_subject_id);var body_field=Ext.getCmp(invite_body_id);if(!subject_field.getValue()){Ext.Msg.alert("\u041e\u0448\u0438\u0431\u043a\u0430","\u041d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u0430 \u0442\u0435\u043c\u0430 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f");return}if(!body_field.getValue()){Ext.Msg.alert("\u041e\u0448\u0438\u0431\u043a\u0430","\u041d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d \u0442\u0435\u043a\u0441\u0442 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f"); return}var params=[];params=component.getForm().getValues();var cpanel=Ext.getCmp(categories_panel_id);params.categories=cpanel.getCategories();if(params.categories.length==0){Ext.Msg.alert("\u041e\u0448\u0438\u0431\u043a\u0430","\u041d\u0435 \u0432\u044b\u0431\u0440\u0430\u043d\u044b \u0441\u0444\u0435\u0440\u044b \u0434\u0435\u044f\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438");return}performRPCCall(RPC.Procedure.sendInvites,[params],{wait_text:"\u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0439..."}, function(response){if(response.success)Ext.Msg.alert("\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f","\u041e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043e \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0439: "+response.invites);else Ext.Msg.alert("\u041e\u0448\u0438\u0431\u043a\u0430",response.message)})}},{text:"\u041e\u0442\u043c\u0435\u043d\u0430",handler:function(){history.back(1)}}],listeners:{beforerender:function(){component.relayEvents(Ext.getCmp(procedure_selection_grid_id), ["load_invite_text"])},load_invite_text:function(){var procedure_selection_grid=Ext.getCmp(procedure_selection_grid_id);var selected=procedure_selection_grid.getSelectionModel().getSelections();var params=[];for(var i=0;i0)performRPCCall(RPC.Procedure.loadInvitesText,[params],{wait_text:"\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442\u0441\u044f \u0448\u0430\u0431\u043b\u043e\u043d \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f..."}, function(response){if(response.success){subject_field.setValue(response.invite_text.subject);body_field.setValue(response.invite_text.body)}else Ext.Msg.alert("\u041e\u0448\u0438\u0431\u043a\u0430",response.message)});else{subject_field.setValue("");body_field.setValue("")}}}});Application.components.ProcedureInvitesForm.superclass.initComponent.call(this)}});Ext.define("Application.components.ProcedureLotShortViewPanel",{extend:"Application.components.keyValue2Panel",title:"\u041e\u0431\u0449\u0438\u0435 \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e \u043b\u043e\u0442\u0435",fields:{"registry_number":"\u041d\u043e\u043c\u0435\u0440 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b:","title":"\u041d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b:","procedure_type_vocab":"\u0424\u043e\u0440\u043c\u0430 \u0442\u043e\u0440\u0433\u043e\u0432:"}, templates:{registry_number:'{registry_number}',title:Ext.util.Format.title,date_published:Ext.util.Format.localDateOnlyRenderer,date_end_registration:Ext.util.Format.localDateText,offers_step_min:Ext.util.Format.formatOffersStep, offers_step_max:Ext.util.Format.formatOffersStep,step_is_exact:function(v){return v?"\u0432\u0430\u043b\u044e\u0442\u0435 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430":"\u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0430\u0445 \u043e\u0442 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0439 \u0446\u0435\u043d\u044b \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"},procedure_type_vocab:'{procedure_type_vocab} c \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435\u043c \u043a\u0432\u0430\u043b\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u043e\u0442\u0431\u043e\u0440\u0430', offers_wait_time:"{offers_wait_time} \u043c\u0438\u043d\u0443\u0442",step_reduction:Ext.util.Format.formatPrice,step_auction:Ext.util.Format.formatPrice},getLotData:function(procedure,lotId){var lotData={};Ext.iterate(procedure.lots,function(currentLotData){if(currentLotData.id==lotId)lotData=currentLotData});return lotData},setValues:function(values,lot){var me=this;var lotData=this.getLotData(values,lot||me.lotId);if(!!lotData)Ext.iterate(lotData["lot_customers"],function(customerInfo,i){me.fields["customer_"+ i+"_name"]="\u0417\u0430\u043a\u0430\u0437\u0447\u0438\u043a:";me.fields["customer_"+i+"_contact_person"]="\u041e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u043b\u0438\u0446\u043e:";values["customer_"+i+"_name"]=customerInfo["full_name"];values["customer_"+i+"_contact_person"]=customerInfo["contact_fio"]});Application.components.ProcedureLotShortViewPanel.superclass.setValues.call(this,values)},initComponent:function(){Application.components.ProcedureLotShortViewPanel.superclass.initComponent.call(this)}});Ext.define("Application.components.ProcedureProlongateForm",{extend:"Ext.form.Panel",frame:false,border:false,initComponent:function(){var component=this;var date_published_id=Ext.id(),date_end_registration_id=Ext.id(),date_end_first_parts_review_id=Ext.id(),date_begin_auction_id=Ext.id(),date_applic_opened_id=Ext.id(),date_itog_id=Ext.id(),time_begin_auction_id=Ext.id();this.common_files_id=Ext.id();this.addEvents("procedurechanged");var datePanel;if(Main.config.multistep_support){component.stepGridStore= new Ext.data.JsonStore({autoDestroy:true,autoLoad:false,idProperty:"id",autoSave:false,paramsAsHash:true,fields:["id","order_number","step_id","date_start","date_end","time_start","time_end"],data:Application.models.Procedure.prepareStepsData(Application.models.Procedure.getType("2").steps,null,2)});datePanel=new Application.components.procedureMultistepGrid({anchor:"100%",frame:false,editable:true,autoScroll:true,autoHeight:true,addstep:false,editstep:Main.config.multistep_edit_support,border:false, loadMask:true,parent:component,baseDate:new Date,listeners:{added:function(){this.addEvents("procedurechanged");this.relayEvents(component,["procedurechanged"]);this.addEvents("stageschanged");this.relayEvents(component,["stageschanged"])}}})}else{datePanel=new Application.components.procedureBasicDates({title:"\u042d\u0442\u0430\u043f\u044b \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f",frame:true,border:false,id:this.formId,hideDatePublished:true});datePanel.relayEvents(this,["procedurechanged"])}Ext.apply(this, {labelWidth:300,frame:true,autoScroll:true,bodyCssClass:"subpanel-top-padding",items:[{xtype:"hidden",name:"lot_id",value:component.lot_id},{xtype:"hidden",name:"procedure_id",value:component.procedure_id},datePanel,{xtype:"fieldset",title:"\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b",items:[{html:"\u0414\u043b\u044f \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0439\u0442\u0435 \u0438\u0445 \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u043e\u0440\u043c\u044b \u043d\u0438\u0436\u0435. "+ ACCEPTED_FILES+".",cls:"spaced-bottom-shallow"},{id:component.common_files_id,xtype:"Application.components.multiuploadPanel",uploadHandler:RPC.Procedure.addFile,deleteHandler:RPC.Procedure.removeFile,name:"common_files",simultaneousUpload:true,autoUpload:true,width:750,listeners:{beforeupload:function(cmp){cmp.uploadParams.procedure_id=component.procedure_id;cmp.uploadParams.type=3}}}]}],buttons:[{text:"\u041f\u0440\u043e\u0434\u043b\u0438\u0442\u044c \u0441\u0440\u043e\u043a \u043f\u043e\u0434\u0430\u0447\u0438 \u0437\u0430\u044f\u0432\u043e\u043a", scope:this,formBind:true,handler:function(){var params=this.getValues();Ext.apply(params,{date_time:Ext.util.Format.localDateRenderer(new Date).replace(" ","")});if(params.time_begin_auction&¶ms.date_begin_auction){var time=params.time_begin_auction.split(":");params.date_begin_auction.setHours(time[0]);params.date_begin_auction.setMinutes(time[1]);params.date_begin_auction.setSeconds(0);params.date_begin_auction.setMilliseconds(0)}var adv_items=component.getHiddenFieldsByParams(params); var win=new Application.components.promptWindow({title:"\u041f\u0440\u043e\u0434\u043b\u0435\u043d\u0438\u0435 \u0441\u0440\u043e\u043a\u0430 \u043f\u043e\u0434\u0430\u0447\u0438 \u0437\u0430\u044f\u0432\u043e\u043a",cmpType:"Application.components.SignatureForm",parentCmp:this,cmpParams:{api:RPC.Lot.prolongate,signatureText:component.getSignText(true,params.date_time),signatureTextHeight:250,useFormHandler:false,items:adv_items,success_fn:function(resp){win.close();Ext.Msg.alert("\u0423\u0441\u043f\u0435\u0448\u043d\u043e", "\u0421\u0440\u043e\u043a\u0438 \u043b\u043e\u0442\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u044b",function(){redirect_to("com/procedure/index")})}}});win.show()}},{text:"\u041e\u0442\u043a\u0430\u0437\u0430 \u043e\u0442 \u043f\u0440\u043e\u0434\u043b\u0435\u043d\u0438\u044f \u0441\u0440\u043e\u043a\u0430 \u043f\u043e\u0434\u0430\u0447\u0438 \u0437\u0430\u044f\u0432\u043e\u043a",scope:this,formBind:true,handler:function(){Ext.Msg.show({title:"\u041e\u0442\u043a\u0430\u0437 \u043e\u0442 \u043f\u0440\u043e\u0434\u043b\u0435\u043d\u0438\u044f \u0441\u0440\u043e\u043a\u0430 \u043f\u043e\u0434\u0430\u0447\u0438 \u0437\u0430\u044f\u0432\u043e\u043a", msg:"\u0412\u044b \u0443\u0432\u0435\u0440\u0435\u043d\u044b \u0447\u0442\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u043e\u0442\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f? \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u043e\u0434\u043b\u0438\u0442\u044c \u0441\u0440\u043e\u043a \u043f\u043e\u0434\u0430\u0447\u0438 \u0437\u0430\u044f\u0432\u043e\u043a \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442.",buttons:Ext.Msg.YESNO,closable:false, fn:function(b){if(b=="yes"){var params={prolongate:false,lot_id:component.lot_id,date_time:Ext.util.Format.localDateRenderer(new Date).replace(" ","")};var adv_items=component.getHiddenFieldsByParams(params);var win=new Application.components.promptWindow({title:"\u041e\u0442\u043a\u0430\u0437\u0430 \u043e\u0442 \u043f\u0440\u043e\u0434\u043b\u0435\u043d\u0438\u044f \u0441\u0440\u043e\u043a\u0430 \u043f\u043e\u0434\u0430\u0447\u0438 \u0437\u0430\u044f\u0432\u043e\u043a",cmpType:"Application.components.SignatureForm", parentCmp:this,cmpParams:{api:RPC.Lot.prolongate,signatureText:component.getSignText(false,params.date_time),signatureTextHeight:250,useFormHandler:false,items:adv_items,success_fn:function(resp){win.close();Ext.Msg.alert("\u0423\u0441\u043f\u0435\u0448\u043d\u043e","\u041b\u043e\u0442 \u043f\u0435\u0440\u0435\u0432\u0435\u0434\u0435\u043d \u043d\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u044d\u0442\u0430\u043f",function(){redirect_to("com/procedure/index")})}}}); win.show()}}},this)}},{text:"\u0417\u0430\u043a\u0440\u044b\u0442\u044c",handler:function(){redirect_to("com/procedure/index")}}],listeners:{beforerender:function(){Ext.getBody().mask("\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435");RPC.Lot.loadLotDates(component.lot_id,function(resp){if(resp.success){var visible,i,item;if(component.prolongate)component.setTitle("\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u043e \u043f\u0440\u043e\u0434\u043b\u0435\u043d\u0438\u0438 \u0441\u0440\u043e\u043a\u0430 \u043f\u0440\u0438\u0435\u043c\u0430 \u0437\u0430\u044f\u0432\u043e\u043a \u043b\u043e\u0442\u0430 \u2116"+ resp.procedure.lot.number+" \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b "+resp.procedure.registry_number);else component.setTitle("\u041f\u0435\u0440\u0435\u0432\u043e\u0434 \u0441\u0440\u043e\u043a\u043e\u0432 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043b\u043e\u0442\u0430 \u2116"+resp.procedure.lot.number+" \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b "+resp.procedure.registry_number);component.procedure=resp.procedure;component.lot=resp.procedure.lot; component.procedure_type=resp.procedure.procedure_type;component.procedure_type_id=resp.procedure.procedure_type;var type=Application.models.Procedure.type_ids[component.procedure_type];if(component.lot.steps&&component.lot.steps!="[]")component.steps=Ext.util.JSON.decode(component.lot.steps);if(!component.steps||!component.steps.length)component.steps=Application.models.Procedure.getType(component.procedure_type).steps;if(Main.config.multistep_support){component.stepGridStore.loadData(Application.models.Procedure.prepareStepsData(component.steps, component.lot.status,component.procedure_type));component.fireEvent("stageschanged",resp.procedure.applic_stages)}else{component.fireEvent("procedurechanged",resp.procedure.procedure_type);setComponentValues(component,component.lot)}}else Ext.Msg.alert("\u041e\u0448\u0438\u0431\u043a\u0430",resp.message);Ext.getBody().unmask()})}},getValues:function(){var dt=null;var v={};collectComponentValues(this,v,true);if(v.date_end_second_parts_review)v.date_end_second_parts_review=v.date_end_second_parts_review.add(Date.MINUTE, 23*60+59);if(v.steps.length)for(var c=0;cb.id)return-1;return 1});for(var i=0;i'}},{header:"\u041e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0442\u043e\u0440",dataIndex:"organizer_contragent_name",width:60},{header:"\u041d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435", dataIndex:"title",width:200}],viewConfig:{forceFit:true,getRowClass:function(record,rowIndex,p,store){return record.data.date_accepted?"x-color-3":null}},sm:selectionModel,border:false,loadMask:true,height:300,autoScroll:true,iconCls:"icon-grid",listeners:{render:function(){dstore.load({callback:function(){if(component.procedure_id){var sm=component.getSelectionModel();dstore.each(function(record){if(record["id"]==component.procedure_id){sm.selectRecords([record]);component.fireEvent("load_invite_text"); return}})}}})}}});Application.components.ProcedureSelectionGrid.superclass.initComponent.call(this)}});Ext.define("Application.components.ProcedureShortViewPanel",{extend:"Application.components.keyValuePanel",title:"\u041e\u0431\u0449\u0438\u0435 \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435",procedure_id:null,autoLoad:false,fields:{"registry_number":"\u041d\u043e\u043c\u0435\u0440 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b:","title":"\u041d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b:", "procedure_type_vocab":"\u0424\u043e\u0440\u043c\u0430 \u0442\u043e\u0440\u0433\u043e\u0432:","org_full_name":"\u041e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0442\u043e\u0440:","contact_person":"\u041e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u043b\u0438\u0446\u043e:","date_published":"\u0414\u0430\u0442\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0438\u0437\u0432\u0435\u0449\u0435\u043d\u0438\u044f:","date_end_registration":"\u0414\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043c\u044f \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u043f\u043e\u0434\u0430\u0447\u0438 \u0437\u0430\u044f\u0432\u043e\u043a:"}, templates:{title:Ext.util.Format.title,date_published:Ext.util.Format.localDateOnlyRenderer,date_end_registration:Ext.util.Format.localDateText,offers_step_min:Ext.util.Format.formatOffersStep,offers_step_max:Ext.util.Format.formatOffersStep,step_is_exact:function(v){return v?"\u0432\u0430\u043b\u044e\u0442\u0435 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430":"\u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0430\u0445 \u043e\u0442 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0439 \u0446\u0435\u043d\u044b \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"}, procedure_type_vocab:'{procedure_type_vocab} c \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435\u043c \u043a\u0432\u0430\u043b\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u043e\u0442\u0431\u043e\u0440\u0430',offers_wait_time:"{offers_wait_time} \u043c\u0438\u043d\u0443\u0442",procedure_subject_codes:new Ext.XTemplate(''+ ''+"{values.full_name}
"+"
"+"
"),procedure_inner_classification:new Ext.XTemplate(''+''+"{values.full_name}
"+"
"+"
"),step_reduction:Ext.util.Format.formatPrice,step_auction:Ext.util.Format.formatPrice,not_dishonest:function(v){return v==1?"\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e":"\u041d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e"}, purchase_inside_avtodor:function(v){return v==1?"\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e":"\u041d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e"},skip_fees:function(v){return v==1?"\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e":"\u041d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e"}},onAfterrender:function(cmp){var me=this;if(!!me.autoLoad)performRPCCall(RPC.Procedure.load,[{procedure_id:me.procedure_id}], {},function(resp){me.setValues(resp)})},setValues:function(values){var valuesCopy={};Ext.apply(valuesCopy,values);var registry_number_template=new Ext.XTemplate('{registry_number}');valuesCopy["registry_number"]=registry_number_template.apply(valuesCopy); Application.components.ProcedureShortViewPanel.superclass.setValues.call(this,valuesCopy)},initComponent:function(){var me=this;Ext.apply(me,{listeners:{afterrender:me.onAfterrender}});Application.components.ProcedureShortViewPanel.superclass.initComponent.call(this)}});Ext.define("Application.components.ProcedureStatisticsPanel",{extend:"Ext.form.Panel",initComponent:function(){var component=this;var start_from_id=Ext.id(),start_till_id=Ext.id();Ext.apply(this,{title:component.title,frame:true,border:false,width:500,bodyCssClass:"subpanel-top-padding",bodyStyle:"padding-top: 5px;",items:[{xtype:"fieldset",autoHeight:true,title:"\u0414\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u0434\u0430\u0442",layout:"column",style:"margin-bottom: 0px",defaults:{border:false, layout:"form"},items:[{columnWidth:.6,labelWidth:115,items:new Ext.form.DateField({name:"start_from",id:start_from_id,format:"d.m.Y",width:120,fieldLabel:"\u0414\u0430\u0442\u0430 \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0438 \u0441"})},{columnWidth:.4,labelWidth:25,items:new Ext.form.DateField({width:120,name:"start_till",id:start_till_id,format:"d.m.Y",fieldLabel:"\u043f\u043e"})}]},{buttonAlign:"right",style:"padding-top: 4px",buttons:[{text:"\u0412\u044b\u0433\u0440\u0443\u0437\u0438\u0442\u044c", handler:function(){var start_from_val=Ext.getCmp(start_from_id).getValue();if(start_from_val)start_from_val=start_from_val.format("d.m.Y");var start_till_val=Ext.getCmp(start_till_id).getValue();if(start_till_val)start_till_val=start_till_val.format("d.m.Y");var href="admin/downloadStatistics";if(start_from_val)href+="/start_from/"+start_from_val;if(start_till_val)href+="/start_till/"+start_till_val;window.location=href}}]}]});Application.components.ProcedureStatisticsPanel.superclass.initComponent.call(this)}});Ext.define("Application.components.ProcedureSubjectCodesPanel",{extend:"Ext.form.FieldSet",initComponent:function(){var component=this;var tree_id=Ext.id();var cc_current=Ext.id();var text_empty=Ext.id();this.addEvents("nomenclatureselected");Ext.apply(this,{layout:"form",anchor:"100%",defaults:{anchor:"100%",allowBlank:false},autoHeight:true,frame:false,labelWidth:200,items:[{xtype:"panel",border:false,id:cc_current,items:[{id:text_empty,bodyCssClass:"subpanel",cls:"spaced-panel",hidden:true,html:"\u041a\u043e\u0434 \u0437\u0430\u043a\u0443\u043f\u043a\u0438 \u043d\u0435 \u0432\u044b\u0431\u0440\u0430\u043d"}], listeners:{afterrender:function(){component.emptyTextShow();component.doLayout()}}}],buttons:[{text:"\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c",handler:function(){var win=new Ext.Window({title:"\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u0434\u0430 \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u0430 \u0437\u0430\u043a\u0443\u043f\u043a\u0438",width:700,height:400,bodyStyle:"padding: 10px",layout:"fit",items:[{id:tree_id,xtype:"Application.components.nomenclatureTree", type:"procedure_subject_codes",selection:this.selection,listeners:{nomenclature_selected:function(n){n.subject_code_id=n.id;delete n.id;component.fireEvent("nomenclatureselected",n);win.close()}}}],buttons:[{xtype:"button",text:"\u0412\u044b\u0431\u0440\u0430\u0442\u044c",handler:function(){var n=Ext.getCmp(tree_id).getSelectedObject();var txt=false;if(!n)txt="\u0412\u044b \u043d\u0435 \u0432\u044b\u0431\u0440\u0430\u043b\u0438 \u043a\u043e\u0434!";else if(!n.leaf)txt="\u0421\u043b\u0435\u0434\u0443\u0435\u0442 \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c \u043a\u043e\u0434, \u0430 \u043d\u0435 \u0446\u0435\u043b\u044b\u0439 \u0440\u0430\u0437\u0434\u0435\u043b"; if(txt)Ext.Msg.alert("\u041e\u0448\u0438\u0431\u043a\u0430",txt);else{n.subject_code_id=n.id;delete n.id;component.fireEvent("nomenclatureselected",n);win.close()}}},{text:"\u0417\u0430\u043a\u0440\u044b\u0442\u044c",handler:function(){win.close()}}]});win.show()}}],listeners:{nomenclatureselected:function(n){component.addCategory(n);component.emptyTextShow();component.doLayout()}},emptyTextShow:function(){var cmp_cc=Ext.getCmp(cc_current);var cmp_te=Ext.getCmp(text_empty);if(cmp_cc.items.length== 1)cmp_te.setVisible(true);else cmp_te.setVisible(false)},addCategory:function(n){var cc_panel=Ext.getCmp(cc_current);cc_panel.add({layout:"column",cls:"spaced-panel",bodyCssClass:"subpanel",border:true,items:[{columnWidth:1,xtype:"panel",layout:"form",border:false,hideTitle:true,cls:"spaced-cell",html:n.full_name},{xtype:"button",text:"\u0423\u0434\u0430\u043b\u0438\u0442\u044c",cls:"spaced-cell",handler:function(){var p=this.findParentByType("panel");var cur_cat=p.getValue();Ext.Msg.confirm("\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435", "\u0412\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u044d\u0442\u0443 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044e '"+cur_cat.name+"'?",function(b){if("yes"==b){p.destroy();component.emptyTextShow()}})}}],procedure_subject_codes:{id:n.id,subject_code_id:n.subject_code_id,name:n.text,full_name:n.full_name,path:n.path},name:"procedure_subject_codes[]",getValue:function(){return this.procedure_subject_codes}})}, removeAllCategories:function(){var cmp_cc=Ext.getCmp(cc_current);var cmp_te=Ext.getCmp(text_empty);cmp_cc.items.each(function(val){if(val.getId()!=cmp_te.getId())val.destroy()})},setValues:function(val){if(val){component.removeAllCategories();for(var prop in val)if(val.hasOwnProperty(prop))component.addCategory(val[prop]);component.emptyTextShow();component.doLayout()}}});Application.components.ProcedureSubjectCodesPanel.superclass.initComponent.call(this)}});Ext.define("Application.components.ProcedureSupervisorActionsPanel",{extend:"Ext.form.Panel",frame:false,border:false,layout:{type:"hbox",defaultMargins:{top:2,bottom:2,left:0,right:2}},actions:[],updateActions:function(){var me=this;me.actionCombo.getStore().loadData(me.actions)},initComponent:function(){var me=this;var comboStore=new Ext.data.JsonStore({autoDestroy:true,fields:["id","title"],data:me.actions||[]});Ext.apply(me,{items:[{xtype:"combo",fieldLabel:"\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435", triggerAction:"all",mode:"local",name:"action",valueField:"id",displayField:"title",idProperty:"id",ref:"actionCombo",emptyText:"\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435",store:comboStore,editable:false,flex:1},{xtype:"button",text:"\u0423\u0434\u0430\u043b\u0438\u0442\u044c",scope:this,handler:function(){var action=me.actionCombo.getValue()||null;return me.handler.call(me,action)}}]});Application.components.ProcedureSupervisorActionsPanel.superclass.initComponent.call(this)}, handler:function(action){return true},addItem:function(id,title){this.actions.push({id:id,title:title});this.updateActions()}});Ext.define("Application.components.PurchasePlanGrid",{extend:"Ext.Window",height:600,width:900,padding:"5px",resizable:false,layout:{type:"vbox"},modal:true,title:"\u0412\u044b\u0431\u043e\u0440 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u043f\u043b\u0430\u043d\u0430",initComponent:function(){var component=this,yearParams={};component.ids=initIds(["search_toolbar_id","select_btn_id","years_combo_id"]);component.addEvents("select_purchase_plan_item");component.store=createPurchasePlanItemStore(); component.selModel=new Ext.grid.RowSelectionModel({"singleSelect":true});if(!Ext.isEmpty(component.contragent))yearParams={"contragent_id":component.contragent.id};component.yearStore=new Ext.data.DirectStore({autoLoad:true,directFn:RPC.Purchaseplan.years,root:"data",idProperty:"plan_year",fields:["plan_year"],baseParams:yearParams});Ext.apply(this,{items:this.getItems(),buttons:this.getButtons()});Application.components.PurchasePlanGrid.superclass.initComponent.call(this);component.store.on("load", function(o,records,options){var btn=Ext.getCmp(component.ids.select_btn_id);if(btn){btn.setDisabled(component.selModel.getCount()==0);var rec=component.selModel.getSelected();if(rec)btn.setDisabled(rec.data.is_selected)}});component.selModel.on("rowselect",function(o,index,rec){Ext.getCmp(component.ids.select_btn_id).setDisabled(o.getCount()==0||rec.data.is_selected)});component.selModel.on("rowdeselect",function(o,index,rec){Ext.getCmp(component.ids.select_btn_id).setDisabled(o.getCount()==0||rec.data.is_selected)})}, getButtons:function(){var component=this;return[{text:"\u0412\u044b\u0431\u0440\u0430\u0442\u044c",hidden:Ext.isDefined(component.getSelection()),disabled:true,id:component.ids.select_btn_id,handler:function(){var rec=component.selModel.getSelected();if(rec){component.fireEvent("select_purchase_plan_item",rec.data);component.close()}}},{text:"\u0417\u0430\u043a\u0440\u044b\u0442\u044c",handler:function(){component.close()}}]},getItems:function(){var component=this,items=[{xtype:"compositefield",items:[{xtype:"displayfield", value:"\u0423\u043a\u0430\u0436\u0438\u0442\u0435 \u0433\u043e\u0434"},{xtype:"combo",name:"year",store:component.yearStore,valueField:"plan_year",displayField:"plan_year",triggerAction:"all",id:component.ids.years_combo_id,listeners:{select:function(combo,record){component.fireEvent("search",{},{plan_year:record.get("plan_year")})}}}]},{flex:1,xtype:"grid",store:component.store,columns:component.getColumns(),viewConfig:{forceFit:true,autoFill:true},autoWidth:true,bbar:component.getBottomBar(component.store), tbar:component.getTopBar(component.store),sm:component.selModel,loadMask:true,getAt:function(rowIndex){return component.store.getAt(rowIndex)}}];return items},listeners:{render:function(o){var search_toolbar=Ext.getCmp(o.ids.search_toolbar_id);search_toolbar.doSearch()},search:function(query,search_params){var component=this,store=component.store;store.baseParams=store.baseParams||{};if(!Ext.isEmpty(component.contragent))store.setBaseParam("contragent_id",component.contragent.id);store.setBaseParam("start", 0);store.setBaseParam("limit",25);if(!Ext.isEmpty(query)&&Ext.isString(query))store.setBaseParam("query",query);if(search_params)for(var sp in search_params){if(!search_params.hasOwnProperty(sp))continue;store.setBaseParam(sp,search_params[sp])}store.load()}},getColumns:function(){var component=this;return[{header:"\u0418\u0414",width:15,dataIndex:"id",hidden:true,renderer:"htmlEncode",sortable:true,align:"right"},{header:"V",width:15,dataIndex:"is_selected",hidden:false,renderer:component.renderers.selected, sortable:true,align:"center"},{header:"\u041f\u043b\u0430\u043d",width:80,dataIndex:"plan_name",hidden:false,renderer:"htmlEncode",sortable:true},{header:"\u0414\u0442. \u043d\u0430\u0447.",width:30,dataIndex:"date_start",hidden:false,renderer:Ext.util.Format.localDateOnlyRenderer,sortable:true},{header:"\u0414\u0442. \u043e\u043a\u043e\u043d\u0447.",width:30,dataIndex:"date_end",hidden:false,renderer:Ext.util.Format.localDateOnlyRenderer,sortable:true},{header:"\u041d/\u043f",width:15,dataIndex:"position_num", hidden:false,renderer:"htmlEncode",sortable:true,align:"right"},{header:"\u041f\u043e\u0437\u0438\u0446\u0438\u044f",width:80,dataIndex:"subject",hidden:false,renderer:"htmlEncode",sortable:true},{header:"\u041c\u0430\u043a\u0441. \u0446\u0435\u043d\u0430",width:40,dataIndex:"max_price",hidden:false,renderer:component.renderers.currency,sortable:true,align:"right"},{header:"\u041a\u043e\u043b-\u0432\u043e",width:15,dataIndex:"quantity",hidden:false,renderer:component.renderers.quantity,sortable:true, align:"right"},{header:"\u0421\u041c\u0421\u041f",width:15,dataIndex:"is_smb",hidden:false,renderer:Ext.util.Format.bool,sortable:true}]},getTopBar:function(){var component=this;return{xtype:"Application.components.searchToolbar",eventTarget:component,searchHelp:"\u0411\u044b\u0441\u0442\u0440\u044b\u0439 \u043f\u043e\u0438\u0441\u043a",id:component.ids.search_toolbar_id}},getBottomBar:function(store){var bbar_items=[];return renderPagingToolbar("\u041f\u043e\u0437\u0438\u0446\u0438\u0438 \u043f\u043b\u0430\u043d\u043e\u0432 \u0437\u0430\u043a\u0443\u043f\u043e\u043a", store,25,bbar_items)},renderers:{currency:function(value,meta,record){var c=false;if(!value)return"\u2014";if(record.data.currency_name){c=Ext.util.Format.htmlEncode(record.data.currency_name);if(record.data.currency_description)c=''+c+""}return Ext.util.Format.formatPrice(value)+(c?" "+c:"")},quantity:function(value,meta,record){var s=false;if(!value)return"\u2014";if(record.data.okei_symbol)s=Ext.util.Format.htmlEncode(record.data.okei_symbol); return Ext.util.Format.htmlEncode(value)+(s?" "+s:"")},selected:function(value,meta,record){if(value)return'V'}},getSelection:function(){var component=this;return component.selModel.getSelected()}});Ext.define("Application.components.RateCriteriesForm",{extend:"Ext.panel.Panel",autoHeight:true,stages:null,procedureType:null,initComponent:function(){var component=this;component.ids=initIds(["criteriaPanel_id","criteria_title_id","weight_title_id","criteria_combo_id","criteria_contract_price_id"]);component.addEvents(["stageschanged"]);Ext.apply(component,{name:"rate_criteries",layout:"form",bodyCssClass:"subpanel",defaults:{anchor:"100%"},labelWidth:350,items:[{xtype:"fieldset",title:"\u041a\u0440\u0438\u0442\u0435\u0440\u0438\u0438", style:"margin-top: 3px; margin-bottom: 0px;",defaults:{anchor:"100%"},labelWidth:350,layout:"table",layoutConfig:{columns:2,tableAttrs:{cellspacing:"5"}},items:[{id:component.ids.criteria_title_id,xtype:"label",html:"\u041a\u0440\u0438\u0442\u0435\u0440\u0438\u0439"+REQUIRED_FIELD},{id:component.ids.weight_title_id,xtype:"label",html:"\u0412\u0435\u0441 \u0432 %"+REQUIRED_FIELD,cellCls:"width_200px"},{id:component.ids.criteria_combo_id,xtype:"combo",width:400,editable:false,triggerAction:"all",mode:"local", valueField:"id",displayField:"title",store:new Ext.data.ArrayStore({fields:["id","title"],data:[["contract_price","\u0426\u0435\u043d\u0430 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"]]}),value:"contract_price",blankText:"\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0432\u0438\u0434 \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u044f \u043e\u0446\u0435\u043d\u043a\u0438"},{id:component.ids.criteria_contract_price_id,xtype:"combo", width:250,name:"criteria_contract_price",mode:"local",displayField:"value",disableKeyFilter:true,triggerAction:"all",allowBlank:false,store:getPrecentageStore(),blankText:"\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0432\u0435\u0441 \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u044f \u043e\u0446\u0435\u043d\u043a\u0438"}]}],listeners:{procedurechanged:function(p){component.procedureType=p;if(p===Application.models.Procedure.type_ids.purchase_with_grade){Ext.getCmp(component.ids.criteria_title_id).setText("\u041a\u0440\u0438\u0442\u0435\u0440\u0438\u0439", false);Ext.getCmp(component.ids.weight_title_id).setText("\u0412\u0435\u0441 \u0432 %",false);Ext.getCmp(component.ids.criteria_combo_id).allowBlank=true;Ext.getCmp(component.ids.criteria_contract_price_id).allowBlank=true}else component.fireEvent("stageschanged",component.stages)},stageschanged:function(stages){component.stages=stages;if(stages==1){Ext.getCmp(component.ids.criteria_title_id).setText("\u041a\u0440\u0438\u0442\u0435\u0440\u0438\u0439",false);Ext.getCmp(component.ids.weight_title_id).setText("\u0412\u0435\u0441 \u0432 %", false);Ext.getCmp(component.ids.criteria_combo_id).allowBlank=true;Ext.getCmp(component.ids.criteria_contract_price_id).allowBlank=true}else if(stages==2&&component.procedureType!==Application.models.Procedure.type_ids.purchase_with_grade){Ext.getCmp(component.ids.criteria_title_id).setText("\u041a\u0440\u0438\u0442\u0435\u0440\u0438\u0439"+REQUIRED_FIELD,false);Ext.getCmp(component.ids.weight_title_id).setText("\u0412\u0435\u0441 \u0432 %"+REQUIRED_FIELD,false);Ext.getCmp(component.ids.criteria_combo_id).allowBlank= false;Ext.getCmp(component.ids.criteria_contract_price_id).allowBlank=false}component.doLayout()}}});Application.components.RateCriteriesForm.superclass.initComponent.call(this);autoSetValue(this)},validate:function(){var validation=isFormValidAdvanced(this);var errors=[];if(validation!==true)Ext.each(validation,function(errorItem){errors.push(errorItem.blankText)});return validation===true?true:errors}});Ext.define("Application.components.TestFeesPanel",{extend:"Ext.panel.Panel",frame:true,initComponent:function(){var me=this;var avtTariffsInput=Ext.id();Ext.apply(me,{items:[{xtype:"tabpanel",bodyCssClass:"x-panel-body",activeTab:0,items:[{title:"\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0442\u0430\u0440\u0438\u0444\u044b",items:[{xtype:"Application.components.FeesGridPanel"}]},{title:"\u0422\u0430\u0440\u0438\u0444\u044b \u0434\u043b\u044f \u043f\u0440\u044f\u043c\u044b\u0445 \u0437\u0430\u043a\u0443\u043f\u043e\u043a", items:[{xtype:"Application.components.FeesGridPanel",type:"avt_single_suplier_tariffs"}]},{title:"\u0422\u0430\u0440\u0438\u0444\u044b \u0434\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0446\u0435\u043d",items:[{xtype:"Application.components.FeesGridPanel",type:"avt_price_request_tariffs"}]},{title:"\u0422\u0430\u0440\u0438\u0444\u044b \u0434\u043b\u044f \u043f\u0440\u044f\u043c\u044b\u0445 \u0437\u0430\u043a\u0443\u043f\u043e\u043a \u0441 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u043e\u043c \u043d\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e", items:[{xtype:"Application.components.FeesGridPanel",type:"avt_single_supplier_sell_contract_tariffs"}]}]}],buttons:[{text:"\u041f\u0435\u0440\u0435\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0442\u0430\u0440\u0438\u0444\u044b \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440",handler:function(){performRPCCall(RPC.Admin.recalculateProcedureFees,[{}],[],function(resp){echoResponseMessage(resp)})}},{text:"\u041d\u0430\u0437\u0430\u0434", handler:function(){text:"\u041d\u0430\u0437\u0430\u0434"}}]});Application.components.TestFeesPanel.superclass.initComponent.call(this)}});Ext.define("Application.components.Trade",{extend:"Ext.form.Panel",lot_id:null,procedure_id:null,initComponent:function(){var component=this;this.is_participant=false;this.no_participant_text=false;this.direction=true;var ids={};var i;var id_fields=["current_price","current_diff","progress","my_last_offer","my_position","time_left","best_offer","trade_duration","offers_count","time_left_estimated","input_offer","disable_offers_hint","avail_offers_from","avail_offers_for","price_hint","offers_step_hint", "error_panel","error_panel_text","offers_grid","offers_chart","no_participant","new_offer","start_price","input_currency","input_offer_row","direction_button","lot_direction_text","price_hint_notbest","avail_notbest_offers_from","avail_notbest_offers_for","offers_step","date_time_begin_auction","step_reduction","step_auction"];this.ids=ids;for(i=0;i\u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435!!!',top:50,height:120,width:400,layout:"fit",buttons:[{text:"\u0417\u0430\u043a\u0440\u044b\u0442\u044c",handler:function(){component.reductionChangePriceWindow.hide()}}],showSingle:function(text){Ext.onReady(function(){if(!component.reductionChangePriceWindow.isVisible())component.reductionChangePriceWindow.show()});Ext.onReady(function(){if(component.reductionChangePriceWindow.isVisible())component.reductionChangePriceWindow.body.update(text)})}}); addEvents(this,["auctionstart","auctionstop","loaded","waitforstart","offersupdated"]);var setFn=function(e,el){component.setOfferPrice(el.innerHTML)};var offers_pager=null;if(this.offers_store.baseParams&&this.offers_store.baseParams.limit)offers_pager=renderPagingToolbar("",this.offers_store,this.offers_store.baseParams.limit);Ext.apply(this,{frame:true,defaults:{border:false,defaults:{border:false}},bodyCssClass:"trade-panel",items:[{layout:"table",width:"100%",layoutConfig:{columns:3},items:[{rowspan:2, cellCls:"trade-column trade-column-left",items:[{xtype:"Application.components.valueField",fieldLabel:"\u041d\u0430\u0447\u0430\u043b\u044c\u043d\u0430\u044f \u0446\u0435\u043d\u0430",id:ids.start_price,value:"\u2014"},{xtype:"Application.components.valueField",cls:"red",fieldLabel:"\u0422\u0435\u043a\u0443\u0449\u0430\u044f \u0446\u0435\u043d\u0430",id:ids.current_price,value:"\u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442"},{xtype:"Application.components.valueField",fieldLabel:"\u0428\u0430\u0433 \u0430\u0443\u043a\u0446\u0438\u043e\u043d\u0430", id:ids.offers_step,value:"\u2014"},{xtype:"Application.components.valueField",fieldLabel:"\u0428\u0430\u0433 \u043f\u043e\u043d\u0438\u0436\u0435\u043d\u0438\u044f",id:ids.step_reduction,value:"\u2014"},{xtype:"Application.components.valueField",fieldLabel:'\u0422\u0435\u043a\u0443\u0449\u0435\u0435 \u0441\u043d\u0438\u0436\u0435\u043d\u0438\u0435',id:ids.current_diff,value:"0%"},{xtype:"progress",width:200,id:ids.progress,value:0},{hidden:true,xtype:"Application.components.valueField", fieldLabel:"\u0412\u0430\u0448\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0446\u0435\u043d\u043e\u0432\u043e\u0435 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435",id:ids.my_last_offer,value:"\u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442"},{xtype:"Application.components.valueField",hidden:true,fieldLabel:"\u0412\u0430\u0448\u0430 \u0442\u0435\u043a\u0443\u0449\u0430\u044f \u043f\u043e\u0437\u0438\u0446\u0438\u044f",id:ids.my_position,value:"-"}, {xtype:"Application.components.valueField",cls:"red",id:ids.time_left,fieldLabel:"\u0412\u0440\u0435\u043c\u0435\u043d\u0438 \u0434\u043e \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f",value:"--:--"}]},{cellCls:"trade-column",cls:"red",xtype:"fieldset",border:true,title:"\u041b\u0443\u0447\u0448\u0435\u0435 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435",items:[{height:52,id:ids.best_offer,html:"\u041d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442"}]}, {cellCls:"trade-column trade-column-right",items:[{xtype:"Application.components.valueField",fieldLabel:"\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0442\u043e\u0440\u0433\u043e\u0432",id:ids.trade_duration,value:"--:--"},{xtype:"Application.components.valueField",fieldLabel:"\u0412\u0441\u0435\u0433\u043e \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043f\u043e\u0434\u0430\u043d\u043e",id:ids.offers_count,value:"\u2014"}, {xtype:"Application.components.valueField",fieldLabel:"\u0420\u0430\u0441\u0447\u0435\u0442\u043d\u044b\u0435 \u0434\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043c\u044f \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f",id:ids.time_left_estimated,value:"--:--"}]},{colspan:2,xtype:"fieldset",hidden:true,id:ids.new_offer,title:"\u041d\u043e\u0432\u043e\u0435 \u0446\u0435\u043d\u043e\u0432\u043e\u0435 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435",border:true,items:[{layout:"table", id:ids.input_offer_row,layoutConfig:{columns:5},items:[{cls:"bold",html:"\u0412\u0430\u0448\u0435 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435:"},{xtype:"button",cls:"x-btn-icon",icon:"/ico/up.png",id:this.ids.direction_button,scope:this,hidden:true,handler:function(){}},{xtype:"Application.components.priceField",cellCls:"trace-input-price",id:ids.input_offer,width:140,allowZero:false,allowNegative:false,allowBlank:false},{cellCls:"x-align-left",id:ids.input_currency,html:"\u2014"}, {cellCls:"x-align-right",xtype:"button",text:"\u041f\u043e\u0434\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435",handler:function(){var input=Ext.getCmp(ids.input_offer);if(!input.isValid()){Ext.Msg.alert("\u041e\u0448\u0438\u0431\u043a\u0430",input.getErrors()[0]);return}var offer={price:input.getValue(),direction:this.direction};this.addOffer(offer)},scope:this}]},{id:ids.disable_offers_hint,hidden:true,html:" "},{id:ids.price_hint,hidden:true,cls:"small-note", html:'\u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u0430\u0432\u0430\u0442\u044c \u0446\u0435\u043d\u043e\u0432\u044b\u0435 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043e\u0442 ... '+'\u0434\u043e ...',listeners:{afterrender:function(){Ext.get(ids.avail_offers_from).on("click",setFn);Ext.get(ids.avail_offers_for).on("click", setFn)}}},{id:ids.price_hint_notbest,hidden:true,cls:"small-note",html:'\u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0434\u0430\u0432\u0430\u0442\u044c \u0446\u0435\u043d\u043e\u0432\u044b\u0435 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043e\u0442 ... '+'\u0434\u043e ...'+ " (\u0442\u043e\u0440\u0433\u0438 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u043e\u0434\u043b\u0435\u043d\u044b \u043d\u0435 \u0431\u0443\u0434\u0443\u0442)",listeners:{afterrender:function(){Ext.get(ids.avail_notbest_offers_from).on("click",setFn);Ext.get(ids.avail_notbest_offers_for).on("click",setFn)}}},{cls:"small-note",html:'...'}]}]},{hidden:true,xtype:"panel",autoHeight:true,layout:"table",id:ids.error_panel, layoutConfig:{columns:2},cls:"warning-panel spaced-bottom",items:[{xtype:"panel",id:ids.error_panel_text,html:"\u0411\u0438\u0434\u0438\u0431\u0438\u0434\u0430 \u0410\u0428\u042b\u041f\u041a\u041e"},{cellCls:"width_100px",xtype:"button",text:"\u041f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443",handler:function(){window.location.reload()}}]},{layout:"table",height:250,width:"100%",items:[{flex:1,cellCls:"trade-column-bottom", height:230,xtype:"fieldset",border:true,title:"\u041f\u043e\u0434\u0430\u043d\u043d\u044b\u0435 \u0446\u0435\u043d\u043e\u0432\u044b\u0435 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f",layout:"fit",items:{xtype:"grid",store:this.offers_store,loadMask:true,cls:"thinborder",id:ids.offers_grid,bbar:offers_pager,viewConfig:{forceFit:true,getRowClass:function(record){if(record.data.highlight)return"highlight";return""}},columns:[new Ext.grid.RowNumberer,{header:"\u0423\u0447\u0430\u0441\u0442\u043d\u0438\u043a", dataIndex:"participant",width:60,hidden:Main.config.trade_hide_participants},{header:"\u041f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435",dataIndex:"price",width:45,sortable:true,renderer:Ext.util.Format.formatPrice},{header:"\u0414\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043c\u044f",dataIndex:"date_added",width:60,sortable:true,renderer:Ext.util.Format.dateRenderer("d.m.Y H:i:s")},{header:"\u041f\u043e\u0434\u0430\u043d\u043e",dataIndex:"auction_stopped_offer",width:60,sortable:true, hidden:true,renderer:function(v){return v?"\u043d\u0430 \u0434\u043e\u043f\u043e\u0434\u0430\u0447\u0435":"\u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f"}}]}},{html:" "},{flex:1,cellCls:"trade-column-bottom",height:230,id:ids.offers_chart,xtype:"fieldset",layout:"fit",border:true,title:"\u0425\u043e\u0434 \u0442\u043e\u0440\u0433\u043e\u0432",items:[]}]},{html:this.no_participant_text,cls:"x-align-center",id:ids.no_participant,hidden:true}]});this.waitForStartTask.scope= this;this.auctionPollTask.scope=this;this.offersCheckTask.scope=this;this.listeners=this.listeners||{};Ext.apply(this.listeners,{render:function(){this.loadData()},auctionstart:function(){this.isRunning=true;this.startPoll()},auctionstop:function(){this.isRunnung=false;Ext.TaskMgr.stop(this.offersCheckTask);Ext.TaskMgr.stop(this.auctionPollTask);Ext.TaskMgr.stop(this.waitForStartTask);var msg="

\u0422\u043e\u0440\u0433\u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u044b

";if(Main.config.allow_participant_docs_update&& this.is_participant&&this.procedure&&this.lot&&this.lot.id&&2==this.procedure.application_stages&&this.procedure.procedure_type==Application.models.Procedure.type_ids.peretorg_reduc)msg+="

"+link_to("com/applic/edit/lot/"+this.lot.id,"\u041e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b \u0437\u0430\u044f\u0432\u043a\u0438 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u0446\u0435\u043d\u043e\u0439, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0439 \u0432 \u0445\u043e\u0434\u0435 \u043f\u0435\u0440\u0435\u0442\u043e\u0440\u0436\u043a\u0438 (\u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438)")+ "

";this.getEl().mask(msg)},waitforstart:function(){Ext.TaskMgr.start(this.waitForStartTask)},loaded:function(){var no_participant=Ext.getCmp(this.ids.no_participant);if(this.is_participant){this.showParticipantFields();no_participant.hide();this.doLayout()}else{this.showParticipantFields(false);no_participant.update(this.no_participant_text);no_participant.show();this.doLayout()}if(this.procedure.procedure_type==Application.models.Procedure.type_ids.auction_up||this.procedure.procedure_type== Application.models.Procedure.type_ids.auction_up_26)Ext.get(this.ids.lot_direction_text).update("\u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u0435");this.offers_store.reload();this.fireEvent("waitforstart")},destroy:function(){Ext.TaskMgr.stop(this.waitForStartTask);Ext.TaskMgr.stop(this.auctionPollTask);Ext.TaskMgr.stop(this.offersCheckTask)},offersupdated:function(){function loadOffer(offer_data){if(!offer_data)return null;offer_data.date_added=parseDate(offer_data.date_added);return{data:offer_data}} var best_offer;var my_offer;if(this.offersRanges){best_offer=loadOffer(this.offersRanges.leading_offer);my_offer=loadOffer(this.offersRanges.my_best_offer)}else{best_offer=this.getLeadingOffer();my_offer=this.getMyBestOffer()}if(this.procedure.procedure_type==Application.models.Procedure.type_ids.public_sale){best_offer=this.getLeadingOffer();my_offer=this.getMyBestOffer()}var last_offer_time;var leading_offer="\u041d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442"; if(best_offer){last_offer_time=best_offer.data.date_added;leading_offer="";if(!Main.config.trade_hide_participants||my_offer&&best_offer.data.participant_id==my_offer.data.participant_id)if(best_offer.data["additional_suppliers"]&&best_offer.data["additional_suppliers"].length>0){var leading_offer_additional_suppliers=[];Ext.iterate(best_offer.data["additional_suppliers"],function(item){leading_offer_additional_suppliers.push(item["full_name"])});leading_offer+=best_offer.data.participant+' (\u0415\u0449\u0435 +'+leading_offer_additional_suppliers.length+")"+"
"}else leading_offer+=best_offer.data.participant+"
";leading_offer+=Ext.util.Format.formatPrice(best_offer.data.price,null,this.procedure.currency_vocab_short)+"
"+Ext.util.Format.localDateRenderer(last_offer_time);var diff=Math.round(1E3*(this.lot.start_price-best_offer.data.price)/this.lot.start_price)/10;if(diff<0)diff=-diff;Ext.getCmp(this.ids.current_diff).setValue(diff+ "%");if(this.procedure.procedure_type==Application.models.Procedure.type_ids.auction_up||this.procedure.procedure_type==Application.models.Procedure.type_ids.auction_up_26)Ext.get(this.ids.lot_direction_text).update("\u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u0435");Ext.getCmp(this.ids.current_price).setValue(Ext.util.Format.price(best_offer.data.price,null,this.procedure.currency_vocab_short))}else if(component.lot&&!component.procedure.price_reduction){last_offer_time=component.lot.date_begin_auction; Ext.getCmp(this.ids.current_price).setValue(Ext.util.Format.price(component.lot.start_price,null,component.procedure.currency_vocab_short))}if(my_offer)Ext.getCmp(this.ids.my_last_offer).setValue(Ext.util.Format.formatPrice(my_offer.data.price,null,this.procedure.currency_vocab_short).replace(/ /g," "),true);this.myPosition=this.offersRanges&&this.offersRanges.my_place?this.offersRanges.my_place:this.getMyPosition();Ext.getCmp(this.ids.my_position).setValue(this.myPosition||"-");var leader_hint= Ext.getCmp(this.ids.disable_offers_hint);var price_hint=Ext.getCmp(this.ids.price_hint);var price_hint_notbest=Ext.getCmp(this.ids.price_hint_notbest);var input_offer_row=Ext.getCmp(this.ids.input_offer_row);var disableOffers=function(reason){if(!this.is_participant)return;input_offer_row.disable();if(price_hint.isVisible())price_hint.hide();if(price_hint_notbest.isVisible())price_hint_notbest.hide();leader_hint.update(reason);if(!leader_hint.isVisible()){leader_hint.show();this.doLayout()}};var enableOffers= function(){input_offer_row.enable();if(leader_hint.isVisible())leader_hint.hide();if(!price_hint.isVisible()){price_hint.show();this.doLayout()}};var current_price=this.lot.start_price;if(best_offer)current_price=best_offer.data.price;var current_supplier_price=my_offer?my_offer.data.price:this.lot.start_price;this.rangeCheck.notbestMax=null;this.rangeCheck.notbestMin=null;this.rangeCheck.max=null;this.rangeCheck.min=null;if(this.offersRanges&&!this.offersRanges.can_trade)disableOffers.call(this, this.offersRanges.message||"\u0412\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u044f\u044f \u043e\u0448\u0438\u0431\u043a\u0430: \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0430\u0432\u0430\u0442\u044c \u0446\u0435\u043d\u043e\u0432\u044b\u0435 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f");else if(this.offersRanges){this.rangeCheck.max=this.offersRanges.max;this.rangeCheck.min=this.offersRanges.min;this.rangeCheck.notbestMax=this.offersRanges.max_notbest; this.rangeCheck.notbestMin=this.offersRanges.min_notbest;enableOffers.call(this);this.updateRanges()}else if(1==this.myPosition)disableOffers.call(this,"\u041f\u043e\u043a\u0430 \u0432\u0430\u0448\u0435 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043b\u0438\u0434\u0438\u0440\u0443\u0435\u0442, \u0432\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0434\u0430\u0432\u0430\u0442\u044c \u0446\u0435\u043d\u043e\u0432\u044b\u0435 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f"); else if(this.is_stopping&&!best_offer)disableOffers.call(this,"\u041f\u0440\u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0438 \u0446\u0435\u043d\u043e\u0432\u044b\u0445 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0434\u043e\u043f\u043e\u0434\u0430\u0447\u0430 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0430");else if(this.is_stopping){if(this.getDirection()>0){this.rangeCheck.max=current_price;this.rangeCheck.min=current_supplier_price+.01}else{this.rangeCheck.max= current_supplier_price-.01;this.rangeCheck.min=current_price}if(this.rangeCheck.max>=this.rangeCheck.min){enableOffers.call(this);this.updateRanges()}else disableOffers.call(this,"\u041d\u0435\u0442 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u0433\u043e \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430 \u0434\u043b\u044f \u0446\u0435\u043d\u043e\u0432\u044b\u0445 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0439")}else{enableOffers.call(this);var step_min;var step_max; if(this.procedure.step_is_exact){step_min=this.procedure.offers_step_min;step_max=this.procedure.offers_step_max}else{step_min=this.lot.start_price*this.procedure.offers_step_min/100;step_max=this.lot.start_price*this.procedure.offers_step_max/100}if(step_min<.01)step_min=.01;if(step_max<.01)step_max=.01;if(this.getDirection()<0){var t=step_min;step_min=-step_max;step_max=-t}this.rangeCheck.min=Math.round(100*current_price+100*step_min)/100;this.rangeCheck.max=Math.round(100*current_price+100*step_max)/ 100;if(this.rangeCheck.min<=this.minimumTradeOffer)this.rangeCheck.min=this.minimumTradeOffer;if(this.rangeCheck.max<=this.minimumTradeOffer)this.rangeCheck.max=this.minimumTradeOffer;if(Main.config.allow_notbest_offers&¤t_price!=this.lot.start_price&¤t_supplier_price!=current_price){if(this.getDirection()>0){this.rangeCheck.notbestMax=current_price;this.rangeCheck.notbestMin=current_supplier_price+.01;if(0==this.rangeCheck.notbestMin)this.rangeCheck.notbestMin+=.01}else{this.rangeCheck.notbestMax= current_supplier_price-.01;this.rangeCheck.notbestMin=current_price;if(0==this.rangeCheck.notbestMax)this.rangeCheck.notbestMax-=.01}if(this.rangeCheck.notbestMax.001)error="\u0412\u0430\u0448\u0435 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432\u044b\u0448\u0435 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u0433\u043e ("+Ext.util.Format.price(max)+")";return error}function checkStep(v,start_price,step_cur,cur){var error=false;var delta=Math.round(100*(v-start_price))/100;if(delta%step_cur<.001||step_cur-delta%step_cur<.001)return error;var val=Ext.util.Format.price(step_cur, null,cur);return"\u0426\u0435\u043d\u0430 \u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 \u043d\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u044e \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0446\u0435\u043d\u044b \u043d\u0430 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0443 "+val+" \u043b\u0438\u0431\u043e \u043a\u0440\u0430\u0442\u043d\u0443\u044e \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0435 "+ val}var time=lz(Math.floor((getServerTime()-this.lot.date_begin_auction)/60))/1E3;if(this.procedure.procedure_type!=Application.models.Procedure.type_ids.public_sale)if(false===of_)error="\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u043d\u044f\u0442\u044c \u0432\u0430\u0448\u0435 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0447\u0438\u0441\u043b\u043e, \u043e\u0442\u0434\u0435\u043b\u044f\u044f \u0434\u0435\u0441\u044f\u0442\u0438\u0447\u043d\u044b\u0435 \u0437\u043d\u0430\u043a\u0438 \u0437\u0430\u043f\u044f\u0442\u043e\u0439 \u0438\u043b\u0438 \u0442\u043e\u0447\u043a\u043e\u0439, \u0438 \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u044f \u0442\u044b\u0441\u044f\u0447\u0438 (\u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e) \u043f\u0440\u043e\u0431\u0435\u043b\u0430\u043c\u0438"; else if(of_<0)error="\u0412\u0430\u0448\u0435 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0447\u0442\u043e \u043d\u0435 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e";else if(Math.abs(of_)<.001)error="\u0412\u0430\u0448\u0435 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0440\u0430\u0432\u043d\u043e \u043d\u0443\u043b\u044e, \u0447\u0442\u043e \u043d\u0435 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e"; else{error=checkRange(of_,this.rangeCheck.min,this.rangeCheck.max);if(error&&Main.config.allow_notbest_offers&&this.rangeCheck.notbestMin&&!this.rangeCheck.notbestMax&&checkRange(of_,this.rangeCheck.notbestMin,this.rangeCheck.notbestMax))error+=", \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0435 \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442 \u0432 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d"; else error=false}else{var best_offer=this.getExpensiveOffer();var cur_price=best_offer?best_offer.data.price:this.lot.start_price;var offers_step_cur=parseInt(this.procedure.step_auction);if(false===of_)error="\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u043d\u044f\u0442\u044c \u0432\u0430\u0448\u0435 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0447\u0438\u0441\u043b\u043e, \u043e\u0442\u0434\u0435\u043b\u044f\u044f \u0434\u0435\u0441\u044f\u0442\u0438\u0447\u043d\u044b\u0435 \u0437\u043d\u0430\u043a\u0438 \u0437\u0430\u043f\u044f\u0442\u043e\u0439 \u0438\u043b\u0438 \u0442\u043e\u0447\u043a\u043e\u0439, \u0438 \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u044f \u0442\u044b\u0441\u044f\u0447\u0438 (\u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e) \u043f\u0440\u043e\u0431\u0435\u043b\u0430\u043c\u0438"; else if(of_<0)error="\u0412\u0430\u0448\u0435 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0447\u0442\u043e \u043d\u0435 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e";else if(Math.abs(of_)<.001)error="\u0412\u0430\u0448\u0435 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0440\u0430\u0432\u043d\u043e \u043d\u0443\u043b\u044e, \u0447\u0442\u043e \u043d\u0435 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e"; else if(typeof this.procedure.status_reduction=="undefined"||this.procedure.status_reduction=="TRADE_STATUS_RUNNING"||this.procedure.status_reduction=="TRADE_STATUS_PRICE_DOWN"){if(this.procedure.status_reduction=="TRADE_STATUS_PRICE_DOWN"){if(of_!=cur_price)error="\u041d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430\u043c \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u044f\u0432\u0438\u0442\u044c \u043e \u043f\u0440\u0438\u043e\u0431\u0440\u0435\u0442\u0435\u043d\u0438\u0438 \u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 \u043f\u043e \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0446\u0435\u043d\u0435"}else if(of_> cur_price)error="\u0412 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u0447\u0430\u0441\u0430 \u0441\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u0430\u0443\u043a\u0446\u0438\u043e\u043d\u0430 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430\u043c \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u044f\u0432\u0438\u0442\u044c \u043e \u043f\u0440\u0438\u043e\u0431\u0440\u0435\u0442\u0435\u043d\u0438\u0438 \u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 \u043f\u043e \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0439 \u0446\u0435\u043d\u0435"; else if(of_-1)this.lot.start_price=Number(this.lot.commodity_price);this.procedure.offers_wait_time=Number(this.procedure.offers_wait_time); this.procedure.first_offer_wait_time=Number(this.procedure.first_offer_wait_time);if(!this.procedure.first_offer_wait_time)this.procedure.first_offer_wait_time=this.procedure.offers_wait_time;this.procedure.offers_step_min=Number(this.procedure.offers_step_min);this.procedure.offers_step_max=Number(this.procedure.offers_step_max);Ext.getCmp(this.ids.start_price).setValue(Ext.util.Format.formatPrice(this.lot.start_price,null,procedure.currency_vocab_short));this.start_price=this.lot.start_price;if(procedure.procedure_type== Application.models.Procedure.type_ids.public_sale){var offers_step_cur=procedure.step_auction;Ext.getCmp(this.ids.step_reduction).setValue(Ext.util.Format.price(procedure.step_reduction,null,this.procedure.currency_vocab_short));Ext.getCmp(this.ids.offers_step).setValue(Ext.util.Format.price(offers_step_cur,null,this.procedure.currency_vocab_short))}else{var offers_step_from=this.lot.start_price*procedure.offers_step_max/100;Ext.getCmp(this.ids.step_reduction).hide();Ext.getCmp(this.ids.offers_step).setValue(Ext.util.Format.price(offers_step_from, null,this.procedure.currency_vocab_short))}this.setTitle((this.isAdditionalTrade(this.lot)?"\u041f\u0440\u0438\u0435\u043c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0446\u0435\u043d\u043e\u0432\u044b\u0445 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0439
":"")+String.format("{4}: {0} \u043b\u043e\u0442 {1}: {2} ({3})",procedure.registry_number,this.lot.number,procedure.title,this.lot.subject,procedure.trade_type));return true},showParticipantFields:function(show){var fields= ["my_last_offer","my_position","new_offer"];for(var i=0;i\u041f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430 \u043d\u0435 \u0432 \u0441\u0442\u0430\u0442\u0443\u0441\u0435 \u0442\u043e\u0440\u0433\u043e\u0432

"); this.last_wait_diff=false;return}if(5!=this.lot.status)return;var diff;if(now)diff=Math.round((time_start-now)/1E3);else diff=null;if(this.last_wait_diff&&diff==this.last_wait_diff)return;if(cnt>1E3/this.waitForStartTask.interval*60*1){Ext.TaskMgr.stop(this.waitForStartTask);this.loadData(true)}this.last_wait_diff=diff;var diff_str="";if(now)diff_str="

\u0422\u043e\u0440\u0433\u0438 \u043d\u0430\u0447\u043d\u0443\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437: "+Ext.util.Format.formatInterval(diff)+"";str+=""+Ext.util.Format.localDateRenderer(time_start)+"

\n"+diff_str}else str+='\u043d\u0435 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043e';this.getEl().mask("

\u0422\u043e\u0440\u0433\u0438 \u0435\u0449\u0435 \u043d\u0435 \u043d\u0430\u0447\u0430\u043b\u0438\u0441\u044c, \u0434\u043e\u0436\u0434\u0438\u0442\u0435\u0441\u044c \u043d\u0430\u0447\u0430\u043b\u0430 \u0442\u043e\u0440\u0433\u043e\u0432

\n"+ str+"

")}}},offersCheckTask:{interval:1E4,run:function(){var component=this;if(!this.lot||this.in_update)return;this.in_update=true;RPC.Offer.getLast(this.lot.id,function(resp){if(!component||component.isDestroyed||component.destroying||!component.offers_store)return;component.in_update=false;if(!resp){component.setError("\u041e\u0448\u0438\u0431\u043a\u0430 \u0441\u0432\u044f\u0437\u0438 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c, \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043d\u0435 \u043f\u0440\u043e\u043f\u0430\u0434\u0435\u0442 \u0447\u0435\u0440\u0435\u0437 30 \u0441\u0435\u043a\u0443\u043d\u0434 \u2014 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443."); return}if(resp.success){component.hideError();if(resp.is_finished){component.fireEvent("auctionstop");return}var need_update=component.is_stopping!=resp.is_stopping;component.setStopping(resp.is_stopping);if(!need_update){var last_id=false;if(component.offersRanges&&component.offersRanges.last_offer)last_id=component.offersRanges.last_offer;else component.offers_store.each(function(r){if(!last_id||r.data.id>last_id)last_id=r.data.id});need_update=last_id!=resp.offer_id}component.updateHeartBeat(); if(need_update)component.offers_store.reload();if(component.procedure.procedure_type==Application.models.Procedure.type_ids.public_sale){component.dateEndAuction=resp.deadline;component.procedure.status_reduction=resp.status_reduction;var a2=component.getMyPosition000(component);if(a2>0){component.myPosition=a2;Ext.getCmp(component.ids.my_position).setValue(component.myPosition||"-")}if(resp.price_reduction>0){var old_price=Ext.getCmp(component.ids.current_price).getValue();var new_price=Ext.util.Format.formatPrice(resp.price_reduction, null,"RUB");if(""!=resp.price_reduction&&old_price!=new_price){var best_price=component.getBestOffer(this);if(best_price&&best_price.data.price)best_price=best_price.data.price;else best_price=resp.price_reduction;Ext.getCmp(component.ids.current_price).setValue(Ext.util.Format.formatPrice(best_price,null,"RUB"));component.lot.start_price=resp.price_reduction;component.procedure.price_reduction=resp.price_reduction;component.procedure.date_reduction=resp.date_reduction;if(component.procedure.status_reduction!= "TRADE_STATUS_PRICE_AUC")component.reductionChangePriceWindow.showSingle("
\u041d\u0430\u0447\u0430\u043b\u044c\u043d\u0430\u044f \u0446\u0435\u043d\u0430 \u0441\u043d\u0438\u0436\u0435\u043d\u0430 \u043d\u0430 \u00ab\u0448\u0430\u0433 \u043f\u043e\u043d\u0438\u0436\u0435\u043d\u0438\u044f\u00bb, \u0442\u0435\u043a\u0443\u0449\u0430\u044f \u0446\u0435\u043d\u0430: "+new_price+"
")}}}}});Ext.getCmp(this.ids.offers_grid).getStore().reload()}}, auctionPollTask:{interval:1E3,run:function(){var now=getServerTime();if(!now)return;if(this.procedure.procedure_type==Application.models.Procedure.type_ids.public_sale){var leader_hint=Ext.getCmp(this.ids.disable_offers_hint);var price_hint=Ext.getCmp(this.ids.price_hint);var input_offer_row=Ext.getCmp(this.ids.input_offer_row);var price_hint_notbest=Ext.getCmp(this.ids.price_hint_notbest);var enableOffers=function(){input_offer_row.enable();if(leader_hint.isVisible())leader_hint.hide();if(!price_hint.isVisible()){price_hint.show(); this.doLayout()}};var disableOffers=function(reason){input_offer_row.disable();if(price_hint.isVisible())price_hint.hide();if(price_hint_notbest.isVisible())price_hint_notbest.hide();if(leader_hint.isVisible())leader_hint.update(reason);if(!leader_hint.isVisible()){leader_hint.show();this.doLayout()}};var timebegin0=this.getAuctionStartTime(this.lot);var timebegin=(new Date(timebegin0)).getTime();var now0=new Date;var hour1st0=timebegin+this.procedure.offers_wait_time*60*1E3;var my_offer=this.getMyBestOffer(); if(my_offer&&Ext.getCmp(this.ids.offers_count).value<2){if(now0\u041f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430 \u043f\u0435\u0440\u0435\u0448\u043b\u0430 \u043d\u0430 \u044d\u0442\u0430\u043f \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0430\u0443\u043a\u0446\u0438\u043e\u043d\u0430.")}}else if(offers_count==0)Ext.getCmp(this.ids.time_left).fieldLabel= '\u0412\u0440\u0435\u043c\u0435\u043d\u0438 \u0434\u043e \u0441\u043d\u0438\u0436\u0435\u043d\u0438\u044f \u0446\u0435\u043d\u044b \u043d\u0430 "\u0448\u0430\u0433 \u043f\u043e\u043d\u0438\u0436\u0435\u043d\u0438\u044f"';else if(offers_count==1)Ext.getCmp(this.ids.time_left).fieldLabel="\u0412\u0440\u0435\u043c\u0435\u043d\u0438 \u0434\u043e \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f";else if(offers_count>1)Ext.getCmp(this.ids.time_left).fieldLabel="\u0412\u0440\u0435\u043c\u0435\u043d\u0438 \u0434\u043e \u043d\u0430\u0447\u0430\u043b\u0430 \u0430\u0443\u043a\u0446\u0438\u043e\u043d\u0430"}if(this.dateEndAuction){var time_left= this.dateEndAuction-now;if(this.is_stopping&&!this.offersRanges){var t=Number(Main.config.allow_stopped_offers);if(1==t)t=this.procedure.offers_wait_time;time_left+=t*6E4}var time_left_str="";if(time_left>=0)time_left_str=Ext.util.Format.digitalInterval(time_left,true);else if(time_left>-3E4)time_left_str="\u043e\u0436\u0438\u0434\u0430\u0435\u043c \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f";else time_left_str= "\u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u043d\u0435\u0442 \u0443\u0436\u0435 "+Ext.util.Format.digitalInterval(-time_left,true)+" \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443";Ext.getCmp(this.ids.time_left).setValue(time_left_str);Ext.getCmp(this.ids.trade_duration).setValue(Ext.util.Format.digitalInterval(now-this.getAuctionStartTime(this.lot), true));Ext.getCmp(this.ids.progress).updateProgress(1-time_left/(this.procedure.offers_wait_time*6E4));this.checkHeartBeat()}}},initChart:function(){if(this.chart)return;var chart=Ext.getCmp(this.ids.offers_chart);var component=this;this.chart=new Application.components.ChartJs({datasets:[{fill:false,borderColor:"rgb(253,81,26)",steppedLine:"after",borderWidth:2}],options:{responsive:true,maintainAspectRatio:false,title:{display:false},legend:{display:false},tooltips:{mode:"index",intersect:false}, hover:{mode:"nearest",intersect:true},elements:{point:{radius:3,pointStyle:"rect"}},scales:{xAxes:[{display:true,offset:true,type:"time",scaleLabel:{display:true,labelString:"\u0412\u0440\u0435\u043c\u044f"},ticks:{display:true,source:"data",callback:function(value){return(new Date(value)).toLocaleTimeString("ru-RU")}},time:{displayFormats:"minute",unit:"minute",tooltipFormat:"H:mm:ss.SSS"}}],yAxes:[{display:true,offset:true,scaleLabel:{display:true,labelString:"\u0426\u0435\u043d\u0430"},ticks:{display:true}}]}}, store:this.offers_store,xField:"date_added",yField:"price",listeners:{beforeLabel:function(storeItem,tooltipItem,data){return["\u0423\u0447\u0430\u0441\u0442\u043d\u0438\u043a: "+storeItem.get("participant"),"\u0426\u0435\u043d\u0430: "+Ext.util.Format.formatPrice(tooltipItem.yLabel)]}}});chart.add(this.chart);chart.doLayout()},getDirection:function(){if(this.procedure.procedure_type==Application.models.Procedure.type_ids.auction_up||this.procedure.procedure_type==Application.models.Procedure.type_ids.auction_up_26|| this.procedure.procedure_type==Application.models.Procedure.type_ids.public_sale)return 1;else if(this.procedure.procedure_type==Application.models.Procedure.type_ids.auction_down||this.procedure.procedure_type==Application.models.Procedure.type_ids.peretorg_reduc)return this.lot.reversed?1:-1;return false},compareOffers:function(of1,of2){if(of1.id==of2.id)return 0;if(of1.price==of2.price&&(of1.reversed&&of2.reversed||!of1.reversed&&!of2.reversed))if(of1.date_added.getTime()==of2.date_added.getTime())return of1.id< of2.id?1:-1;else return of1.date_added0)return of1.price>of2.price?1:-1;else{if(of1.reversed&&!of2.reversed)return 1;if(!of1.reversed&&of2.reversed)return-1;return of1.price0)record=r});return record},getExpensiveOffer:function(){var record=null;var dir=this.getDirection();var self=this;if(this.offers_store)this.offers_store.each(function(r){if(!record)record=r;else if(self.compareOffers(r.data,record.data)>0)record=r});return record},getMyPosition:function(){var offers=[];if(!Main.contragent)return null;this.offers_store.each(function(r){offers.push(r.data)}); offers.sort(this.getReverseSortFn());var positions=[];for(var i=0;i0)my_offer=r});return my_offer},getBestOffer:function(){var cmp=this;if(!this.is_participant)return null;var best_offer=null;this.offers_store.each(function(r){if(!best_offer|| r.data.price>best_offer.data.price)best_offer=r});return best_offer},setOfferPrice:function(price){price=price.replace(/[^\d,.]+/g,"");price=price.replace(/,/g,".");Ext.getCmp(this.ids.input_offer).setValue(price)},updateRanges:function(){var cmp;cmp=Ext.get(this.ids.avail_offers_from);if(cmp)cmp.update(Ext.util.Format.formatPrice(this.rangeCheck.min,null,this.procedure.currency_vocab_short));cmp=Ext.get(this.ids.avail_offers_for);if(cmp)cmp.update(Ext.util.Format.formatPrice(this.rangeCheck.max, null,this.procedure.currency_vocab_short));var offers_input=Ext.getCmp(this.ids.input_offer);var price_hint_notbest=Ext.getCmp(this.ids.price_hint_notbest);if(Main.config.allow_notbest_offers&&this.rangeCheck.notbestMin&&this.rangeCheck.notbestMax){cmp=Ext.get(this.ids.avail_notbest_offers_from);if(cmp)cmp.update(Ext.util.Format.formatPrice(this.rangeCheck.notbestMin,null,this.procedure.currency_vocab_short));cmp=Ext.get(this.ids.avail_notbest_offers_for);if(cmp)cmp.update(Ext.util.Format.formatPrice(this.rangeCheck.notbestMax, null,this.procedure.currency_vocab_short));if(!price_hint_notbest.isVisible())price_hint_notbest.show();offers_input.minValue=Math.min(this.rangeCheck.min,this.rangeCheck.notbestMin);offers_input.maxValue=Math.max(this.rangeCheck.max,this.rangeCheck.notbestMax)}else{if(price_hint_notbest.isVisible())price_hint_notbest.hide();offers_input.minValue=this.rangeCheck.min;offers_input.maxValue=this.rangeCheck.max}if(this.procedure.procedure_type==Application.models.Procedure.type_ids.public_sale){offers_input.minValue= null;offers_input.maxValue=null}},updateHeartBeat:function(){this.lastHeartBeat=(new Date).getTime()},checkHeartBeat:function(){if(!this.lastHeartBeat)return;var local_now=(new Date).getTime();var delay=local_now-this.lastHeartBeat;if(delay<0){this.updateHeartBeat();return}delay=Math.round(delay/1E3);if(delay>30)this.setError("\u041f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u0441\u0432\u043e\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a \u0441\u0435\u0442\u0438 \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442! "+ "\u041e\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0434\u043e\u043b\u0433\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0435 \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u043b\u043e \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438. "+"\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u0431\u044b\u043b\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e "+ Ext.util.Format.formatInterval(delay)+" \u043d\u0430\u0437\u0430\u0434. "+"\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u043c\u044b\u0435 \u0432 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e \u0446\u0435\u043d\u043e\u0432\u044b\u0445 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445 \u0430\u0443\u043a\u0446\u0438\u043e\u043d\u0430 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b. "+ "\u0415\u0441\u043b\u0438 \u044d\u0442\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043d\u0435 \u0438\u0441\u0447\u0435\u0437\u043d\u0435\u0442 \u0432 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0438\u0435 30 \u0441\u0435\u043a\u0443\u043d\u0434 \u2014 \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443.")},setStopping:function(is_stopping,updateranges){if(undefined=== updateranges)updateranges=false;if(is_stopping){if(!this.is_stopping){if(updateranges)this.fireEvent("offersupdated");Ext.Msg.alert("\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435","\u0421\u0440\u043e\u043a \u043f\u043e\u0434\u0430\u0447\u0438 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0438\u0441\u0442\u0435\u043a. \u0418\u0434\u0435\u0442 \u0434\u043e\u043f\u043e\u0434\u0430\u0447\u0430...");this.setTitle(String.format('\u041f\u0435\u0440\u0438\u043e\u0434 \u0434\u043e\u043f\u043e\u0434\u0430\u0447\u0438! {4}: {0} \u043b\u043e\u0442 {1}: {2} ({3})', this.procedure.registry_number,this.lot.number,this.procedure.title,this.lot.subject,this.procedure.trade_type))}this.is_stopping=true}else{if(this.is_stopping){if(updateranges)this.fireEvent("offersupdated");Ext.Msg.alert("\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435","\u0414\u043e\u043f\u043e\u0434\u0430\u0447\u0430 \u043f\u043e\u0447\u0435\u043c\u0443-\u0442\u043e \u043f\u0440\u0435\u043a\u0440\u0430\u0442\u0438\u043b\u0430\u0441\u044c \u0438 \u0430\u0443\u043a\u0446\u0438\u043e\u043d \u0432\u0435\u0440\u043d\u0443\u043b\u0441\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f. \u0422\u0430\u043a\u043e\u0433\u043e \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c, \u0441\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0447\u0442\u043e-\u0442\u043e \u043d\u0435\u043f\u0440\u0435\u0434\u0432\u0438\u0434\u0435\u043d\u043d\u043e\u0435.
\n"+ '\u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u043c \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443.')}this.is_stopping=false}}});Ext.define("Application.components.appreqForm",{extend:"Ext.panel.Panel",autoHeight:true,initComponent:function(){var contr_guarantee_id=Ext.id(),app_guarantee_id=Ext.id(),app_guarantee_price_id=Ext.id(),app_guarantee_cb_id=Ext.id(),contr_guarantee_cb_id=Ext.id();var advance_guarantee_id=Ext.id(),warranty_guarantee_id=Ext.id(),advance_guarantee_cb_id=Ext.id(),warranty_guarantee_cb_id=Ext.id(),advance_guarantee_type_id=Ext.id(),warranty_duration_id=Ext.id(),simple_evaluation_criteries_title_id=Ext.id(), simple_evaluation_criteries_ta_id=Ext.id();var warranty_payments_id=Ext.id(),warranty_payments_cb_id=Ext.id();var warranty_guarantee_period_id=Ext.id(),warranty_guarantee_period_cb_id=Ext.id();var component=this;var use_payments_to_customer_account_id=Ext.id();var use_payments_to_etp_account_id=Ext.id();var guarantee_id=Ext.id();var req_method_select_panel_id=Ext.id();var no_price_ids=[guarantee_id,req_method_select_panel_id];var no_simple_criteries=[simple_evaluation_criteries_title_id,simple_evaluation_criteries_ta_id]; var insurance_types_id=Ext.id(),insurance_switch_id=Ext.id();var msp_supplier_req_id=Ext.id();var requires_subcontracting_req_id=Ext.id();var supplier_req_id=Ext.id();var app_guarantee_bank_id=Ext.id();var reasons_store=[],documents_store=[];if(Main.config.detailed_requirements){reasons_store=getStore("doc_vocabs_reasons",{autoLoad:true,directFn:RPC.Reference.docvocabsIndex,root:"vocabs",idProperty:"id",paramsAsHash:true,fields:["id","vocab"],baseParams:{type:1}});documents_store=getStore("doc_vocabs_documents", {autoLoad:true,directFn:RPC.Reference.docvocabsIndex,root:"vocabs",idProperty:"id",paramsAsHash:true,fields:["id","vocab"],baseParams:{type:2}})}addEvents(this,["procedurechanged","stageschanged","startpricechanged","lotpricechanged","onEditing"]);var app_parts_store=new Ext.data.JsonStore({fields:["id","text","disabled"],data:[{id:1,text:"\u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0437\u0430\u044f\u0432\u043a\u0438",disabled:false},{id:2,text:"\u0432\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0437\u0430\u044f\u0432\u043a\u0438", disabled:true}]});var doc_req={name:"lot_doc_requirements[]",defaults:{allowBlank:false,anchor:"100%"},border:true,layout:"form",labelWidth:300,bodyStyle:"padding-top: 10px",style:"margin-top: 10px; margin-bottom: 0px; padding-bottom: 0px;",items:[{xtype:"combo",fieldLabel:"\u041d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u043e\u0433\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430",store:documents_store,hideTrigger:true, displayField:"vocab",name:"requirement",mode:"local"},{xtype:"combo",fieldLabel:"\u041e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430",store:reasons_store,allowBlank:true,hideTrigger:true,displayField:"vocab",name:"reason",mode:"local"},{xtype:"Application.components.combo",fieldLabel:"\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d", disabledField:"disabled",displayField:"text",valueField:"id",store:app_parts_store,name:"application_part",value:1,mode:"local",editable:false,triggerAction:"all"},{fieldLabel:" ",hideLabel:false,labelSeparator:"",html:"(\u0434\u043b\u044f \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u044b\u0445 \u0430\u0443\u043a\u0446\u0438\u043e\u043d\u043e\u0432 \u0441 \u0434\u0432\u0443\u043c\u044f \u044d\u0442\u0430\u043f\u0430\u043c\u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044f \u0437\u0430\u044f\u0432\u043e\u043a)"}], buttons:[{text:"\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0435",handler:function(){var cmp=this.findParentByType("fieldset");if(cmp){component.remove(cmp);component.doLayout()}}}],getValue:function(){var v={};if(this.requirement_id)v.id=this.requirement_id;collectComponentValues(this,v,true);return v}};var applic_guarantee={xtype:"Application.components.sliderField",defaults:{height:22},numberParams:{xtype:"Application.components.priceField"}, increment:1,maxValue:0,fieldLabel:"\u0420\u0430\u0437\u043c\u0435\u0440 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0437\u0430\u044f\u0432\u043a\u0438 \u043d\u0430 \u0443\u0447\u0430\u0441\u0442\u0438\u0435 \u0432 \u0432\u0430\u043b\u044e\u0442\u0435 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430",name:"guarantee_application",id:app_guarantee_id,getValues:function(){return this.hidden?Ext.getCmp(app_guarantee_price_id).getValue():this.getValue()},setValues:function(val){if(val){this.setValue(val); Ext.getCmp(app_guarantee_price_id).setValue(val)}}};var applic_guarantee_price={xtype:"Application.components.priceField",fieldLabel:"\u0420\u0430\u0437\u043c\u0435\u0440 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0437\u0430\u044f\u0432\u043a\u0438 \u043d\u0430 \u0443\u0447\u0430\u0441\u0442\u0438\u0435 \u0432 \u0432\u0430\u043b\u044e\u0442\u0435 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430",name:"guarantee_application_price",hidden:true,id:app_guarantee_price_id};var advance_guarantee= {xtype:"Application.components.sliderField",numberParams:{xtype:"Application.components.priceField"},disabled:true,maxValue:0,fieldLabel:"\u0420\u0430\u0437\u043c\u0435\u0440 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430 \u0430\u0432\u0430\u043d\u0441\u0430",name:"guarantee_advance",id:advance_guarantee_id};if(!Main.config.advance_guarantee_configurable)advance_guarantee={xtype:"displayfield",fieldLabel:"\u0420\u0430\u0437\u043c\u0435\u0440 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430 \u0430\u0432\u0430\u043d\u0441\u0430", value:"\u0432 \u0440\u0430\u0437\u043c\u0435\u0440\u0435 \u043d\u0435 \u043c\u0435\u043d\u0435\u0435 \u0441\u0443\u043c\u043c\u044b \u0430\u0432\u0430\u043d\u0441\u043e\u0432\u044b\u0445 \u043f\u043b\u0430\u0442\u0435\u0436\u0435\u0439"};var warranty_payments_checkbox={};var warranty_payments_slider={};if(Main.config.warranty_payments){Ext.apply(warranty_payments_checkbox,{xtype:"checkbox",hideLabel:true,boxLabel:"\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u0440\u0430\u0437\u043c\u0435\u0440 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430 \u043f\u043e \u0443\u043f\u043b\u0430\u0442\u0435 \u043b\u044e\u0431\u044b\u0445 \u043f\u043b\u0430\u0442\u0435\u0436\u0435\u0439 (\u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0430\u0432\u0430\u043d\u0441\u043e\u0432\u044b\u0445), \u0432 \u0442.\u0447. \u0441\u0443\u043c\u043c \u043d\u0435\u0443\u0441\u0442\u043e\u0435\u043a", id:warranty_payments_cb_id,name:"warranty_payments_set",listeners:{check:function(cb,checked){callComponents([warranty_payments_id],function(cmp){if(checked)cmp.enable();else cmp.disable()})}}});Ext.apply(warranty_payments_slider,{disabled:true,name:"warranty_payments",id:warranty_payments_id,xtype:"Application.components.sliderField",numberParams:{xtype:"Application.components.priceField"},maxValue:0})}var warranty_guarantee_period_checkbox={};var warranty_guarantee_period_slider={};if(Main.config.warranty_guarantee_period){Ext.apply(warranty_guarantee_period_checkbox, {xtype:"checkbox",hideLabel:true,boxLabel:"\u041e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432 \u043d\u0430 \u043f\u0435\u0440\u0438\u043e\u0434 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0439\u043d\u043e\u0439 \u044d\u043a\u0441\u043f\u043b\u0443\u0430\u0442\u0430\u0446\u0438\u0438",id:warranty_guarantee_period_cb_id,name:"warranty_guarantee_period_set", listeners:{check:function(cb,checked){callComponents([warranty_guarantee_period_id],function(cmp){if(checked)cmp.enable();else cmp.disable()})}}});Ext.apply(warranty_guarantee_period_slider,{disabled:true,name:"warranty_guarantee_period",id:warranty_guarantee_period_id,xtype:"Application.components.sliderField",numberParams:{xtype:"Application.components.priceField"},maxValue:0,fieldLabel:"\u0420\u0430\u0437\u043c\u0435\u0440 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432 \u043d\u0430 \u043f\u0435\u0440\u0438\u043e\u0434 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0439\u043d\u043e\u0439 \u044d\u043a\u0441\u043f\u043b\u0443\u0430\u0442\u0430\u0446\u0438\u0438"})}var warranty_slider= {disabled:true,fieldLabel:"\u0420\u0430\u0437\u043c\u0435\u0440 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0439\u043d\u044b\u0445 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432",name:"guarantee_warranty",id:warranty_guarantee_id};if("percent"==Main.config.warranty_guarantee_type){warranty_slider.xtype="Application.components.percentSlider";warranty_slider.fieldLabel+=" (\u0432 % \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u0442\u043e\u0433\u043e\u0432\u043e\u0439 \u0446\u0435\u043d\u044b \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430)"; warranty_slider.numberField=true}else if("text"==Main.config.warranty_guarantee_type){warranty_slider.xtype="textfield";warranty_slider.name="guarantee_warranty_text"}else Ext.apply(warranty_slider,{xtype:"Application.components.sliderField",numberParams:{xtype:"Application.components.priceField"},maxValue:0});var contr_guarantee_slider={disabled:true,fieldLabel:"\u0420\u0430\u0437\u043c\u0435\u0440 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430", name:"guarantee_contract",id:contr_guarantee_id};Ext.apply(contr_guarantee_slider,{xtype:"Application.components.sliderField",numberParams:{xtype:"Application.components.priceField"},maxValue:0,fieldLabel:"\u0420\u0430\u0437\u043c\u0435\u0440 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u0432 \u0432\u0430\u043b\u044e\u0442\u0435 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"});var guaranteeApplicationHandler=function(cmp){return true}; var guaranteeAppHandler=function(cmp){var guarantee_app=Ext.getCmp(app_guarantee_id);if(cmp.checked)guarantee_app.enable();else guarantee_app.disable()};var contrGuaranteeHandler=function(cmp){var contr_guarantee=Ext.getCmp(contr_guarantee_id);if(cmp.checked)contr_guarantee.enable();else contr_guarantee.disable()};Ext.apply(this,{layout:"form",bodyCssClass:"subpanel",defaults:{anchor:"100%"},labelWidth:350,items:[{title:"\u0421\u043f\u043e\u0441\u043e\u0431 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f", xtype:"fieldset",id:req_method_select_panel_id,layout:"form",style:"margin-top: 3px; margin-bottom: 0px;",defaults:{anchor:"100%"},labelWidth:350,items:[{xtype:"checkbox",hideLabel:true,id:use_payments_to_etp_account_id,name:"use_payments_to_etp_account",boxLabel:"\u0432\u043d\u0435\u0441\u0435\u043d\u0438\u0435 \u0434\u0435\u043d\u0435\u0436\u043d\u044b\u0445 \u0441\u0440\u0435\u0434\u0441\u0442\u0432 \u043d\u0430 \u0440\u0435\u043a\u0432\u0438\u0437\u0438\u0442\u044b \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043b\u043e\u0449\u0430\u0434\u043a\u0438", checked:true,listeners:{check:function(cmp,checked){Ext.getCmp(use_payments_to_customer_account_id).setDisabled(checked)},render:function(cmp){cmp.fireEvent("check",cmp,cmp.getValue())}}},{xtype:"checkbox",hideLabel:true,id:use_payments_to_customer_account_id,name:"use_payments_to_customer_account",boxLabel:"\u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0434\u0435\u043d\u0435\u0436\u043d\u044b\u0445 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 \u043d\u0430 \u0440\u0435\u043a\u0432\u0438\u0437\u0438\u0442\u044b \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u0430", listeners:{check:function(cmp,checked){Ext.getCmp(use_payments_to_etp_account_id).setDisabled(checked)},render:function(cmp){cmp.fireEvent("check",cmp,cmp.getValue())}}},{xtype:"checkbox",hideLabel:true,readOnly:true,boxLabel:"\u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0431\u0430\u043d\u043a\u043e\u0432\u0441\u043a\u043e\u0439 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0438",name:"bank_guarantee",id:app_guarantee_bank_id,listeners:{check:guaranteeApplicationHandler, afterrender:guaranteeApplicationHandler}}]},{title:"\u0422\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u043a \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044e",xtype:"fieldset",id:guarantee_id,layout:"form",style:"margin-top: 3px; margin-bottom: 0px;",defaults:{anchor:"100%"},labelWidth:350,items:[{xtype:"checkbox",hideLabel:true,boxLabel:"\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0437\u0430\u044f\u0432\u043a\u0438 \u043f\u0443\u0442\u0435\u043c \u0432\u043d\u0435\u0441\u0435\u043d\u0438\u044f \u0434\u0435\u043d\u0435\u0436\u043d\u044b\u0445 \u0441\u0440\u0435\u0434\u0441\u0442\u0432", name:"guarantee_application_set",id:app_guarantee_cb_id,checked:true,listeners:{check:guaranteeAppHandler,afterrender:guaranteeAppHandler}},applic_guarantee,applic_guarantee_price,{xtype:"checkbox",hideLabel:true,boxLabel:"\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430", id:contr_guarantee_cb_id,name:"guarantee_contract_set",listeners:{check:contrGuaranteeHandler,afterrender:contrGuaranteeHandler}},contr_guarantee_slider,{xtype:"checkbox",hideLabel:true,boxLabel:"\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430 \u0430\u0432\u0430\u043d\u0441\u0430",id:advance_guarantee_cb_id, name:"guarantee_advance_set",listeners:{check:function(cb,checked){callComponents([advance_guarantee_id,advance_guarantee_type_id],function(cmp){if(checked)cmp.enable();else cmp.disable()})}}},{xtype:"combo",editable:false,triggerAction:"all",id:advance_guarantee_type_id,disabled:true,fieldLabel:"\u0421\u0440\u043e\u043a \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430 \u0430\u0432\u0430\u043d\u0441\u0430", mode:"local",displayField:"name",valueField:"id",store:getGuaranteeAdvanceTypesStore(),name:"guarantee_advance_type"},advance_guarantee,{xtype:"checkbox",hideLabel:true,boxLabel:"\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0439\u043d\u044b\u0445 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432", id:warranty_guarantee_cb_id,name:"guarantee_warranty_set",listeners:{check:function(cb,checked){callComponents([warranty_guarantee_id,warranty_duration_id],function(cmp){if(checked)cmp.enable();else cmp.disable()})}}},warranty_slider,warranty_payments_checkbox,warranty_payments_slider,warranty_guarantee_period_checkbox,warranty_guarantee_period_slider]},{title:"\u0422\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u043a \u0441\u0442\u0440\u0430\u0445\u043e\u0432\u0430\u043d\u0438\u044e",xtype:"fieldset", hidden:!Main.config.insurance_types,layout:"form",style:"margin-top: 3px; margin-bottom: 0px;",defaults:{anchor:"100%"},labelWidth:350,items:[{xtype:"checkbox",hideLabel:true,boxLabel:"\u0423\u0441\u043b\u043e\u0432\u0438\u044f\u043c\u0438 \u0437\u0430\u043a\u0443\u043f\u043a\u0438 \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043e \u0441\u0442\u0440\u0430\u0445\u043e\u0432\u0430\u043d\u0438\u0435",id:insurance_switch_id,listeners:{check:function(cb,checked){var insurance_types= Ext.getCmp(insurance_types_id);insurance_types.setVisible(checked);if(!checked)insurance_types.setValue(1)}}},{title:"\u0412\u0438\u0434\u044b \u0441\u0442\u0440\u0430\u0445\u043e\u0432\u0430\u043d\u0438\u044f",xtype:"fieldset",layout:"form",id:insurance_types_id,hidden:true,style:"margin-top: 3px; margin-bottom: 0px;",defaults:{anchor:"100%"},name:"insurance_types",setValue:function(val){if(val){if(val!=1){Ext.getCmp(insurance_switch_id).setValue(true);this.setVisible(true)}setComponentValues(this, {"insurance_types[]":val})}},getValue:function(){var v={};collectComponentValues(this,v,true);var result=1;for(var prop in v.insurance_types)if(v.insurance_types.hasOwnProperty(prop))result*=v.insurance_types[prop];return result},labelWidth:350,items:[{xtype:"checkbox",hideLabel:true,boxLabel:"\u0421\u0442\u0440\u0430\u0445\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u044c\u043d\u043e-\u043c\u043e\u043d\u0442\u0430\u0436\u043d\u044b\u0445 \u0440\u0438\u0441\u043a\u043e\u0432", name:"insurance_types[]",setValues:function(val){this.setValue(val%2==0?true:false)},getValues:function(){return this.getValue()?2:1}},{xtype:"checkbox",hideLabel:true,boxLabel:"\u0421\u0442\u0440\u0430\u0445\u043e\u0432\u0430\u043d\u0438\u0435 \u0433\u0440\u0443\u0437\u043e\u0432 \u043d\u0430 \u0432\u0440\u0435\u043c\u044f \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438",name:"insurance_types[]",setValues:function(val){this.setValue(val%3==0?true:false)}, getValues:function(){return this.getValue()?3:1}},{xtype:"checkbox",hideLabel:true,boxLabel:"\u0421\u0442\u0440\u0430\u0445\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u0430 \u043e\u0442 \u043d\u0435\u0441\u0447\u0430\u0441\u0442\u043d\u043e\u0433\u043e \u0441\u043b\u0443\u0447\u0430\u044f",name:"insurance_types[]",setValues:function(val){this.setValue(val%5==0?true:false)},getValues:function(){return this.getValue()?5:1}},{xtype:"checkbox",hideLabel:true, boxLabel:"\u0421\u0442\u0440\u0430\u0445\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u043f\u0435\u0440\u0435\u0434 \u0442\u0440\u0435\u0442\u044c\u0438\u043c\u0438 \u043b\u0438\u0446\u0430\u043c\u0438 (\u0441\u0442\u0440\u0430\u0445\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0438, \u0441\u0442\u0440\u0430\u0445\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0431\u0449\u0435\u0433\u0440\u0430\u0436\u0434\u0430\u043d\u0441\u043a\u043e\u0439 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0438 \u0442.\u0434)", name:"insurance_types[]",setValues:function(val){this.setValue(val%7==0?true:false)},getValues:function(){return this.getValue()?7:1}},{xtype:"checkbox",hideLabel:true,boxLabel:"\u0418\u043d\u044b\u0435 \u0432\u0438\u0434\u044b \u0441\u0442\u0440\u0430\u0445\u043e\u0432\u0430\u043d\u0438\u044f (\u0441\u0442\u0440\u0430\u0445\u043e\u0432\u0430\u043d\u0438\u0435 \u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430, \u043b\u0438\u0447\u043d\u043e\u0435 \u0441\u0442\u0440\u0430\u0445\u043e\u0432\u0430\u043d\u0438\u0435, \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u044b\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0441\u0442\u0440\u0430\u0445\u043e\u0432\u0430\u043d\u0438\u044f)", name:"insurance_types[]",setValues:function(val){this.setValue(val%11==0?true:false)},getValues:function(){return this.getValue()?11:1}}]}]},{xtype:"fieldset",hidden:!Main.config.lot_intention_notify,layout:"form",style:"margin-top: 10px; margin-bottom: 0px;",defaults:{anchor:"100%"},labelWidth:350,items:[{fieldLabel:"\u0423\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u043e \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u0438\u0438 \u043f\u0440\u0438\u043d\u044f\u0442\u044c \u0443\u0447\u0430\u0441\u0442\u0438\u0435", border:false},{xtype:"textarea",name:"intention_notify",hideLabel:true}]},{title:"\u0422\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u043a \u0441\u0443\u0431\u044a\u0435\u043a\u0442\u0430\u043c \u043c\u0430\u043b\u043e\u0433\u043e \u0438 \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u043f\u0440\u0435\u0434\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430",xtype:"fieldset",id:supplier_req_id,layout:"form",style:"margin-top: 3px; margin-bottom: 0px;", defaults:{anchor:"100%"},labelWidth:350,items:[{xtype:"checkbox",hideLabel:true,boxLabel:"\u0423\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430\u043c\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0443\u0431\u044a\u0435\u043a\u0442\u044b \u043c\u0430\u043b\u043e\u0433\u043e \u0438 \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u043f\u0440\u0435\u0434\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430", id:msp_supplier_req_id,name:"small_biz_only",listeners:{check:function(cb,checked){var bank_guarantee=Ext.getCmp(app_guarantee_bank_id);var guarantee_money=Ext.getCmp(app_guarantee_cb_id);if(!checked&&bank_guarantee.getValue())bank_guarantee.setValue(false);if(checked&&guarantee_money.getValue())bank_guarantee.setValue(true)}}},{xtype:"checkbox",hideLabel:true,boxLabel:"\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f \u0441\u0443\u0431\u043f\u043e\u0434\u0440\u044f\u0434\u0447\u0438\u043a\u043e\u0432 (\u0441\u043e\u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u0435\u0439) \u0438\u0437 \u0447\u0438\u0441\u043b\u0430 \u0441\u0443\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043c\u0430\u043b\u043e\u0433\u043e \u0438 \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u043f\u0440\u0435\u0434\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430", id:requires_subcontracting_req_id,name:"requires_subcontracting"}]}],buttons:[{text:"\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u043a \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u043c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u043c",hidden:!Main.config.detailed_requirements,handler:function(){component.addRequirement()}}],addRequirement:function(req,nolayout){var cmp=new Ext.form.FieldSet(doc_req); if(req){cmp.requirement_id=req.id;setComponentValues(cmp,req,true)}this.add(cmp);if(!nolayout)this.doLayout()},setValues:function(v){if(v.guarantee_contract)v.guarantee_contract=parseFloat(v.guarantee_contract);if(v.guarantee_warranty)v.guarantee_warranty=parseFloat(v.guarantee_warranty);if(v.use_payments_to_etp_account==undefined)v.use_payments_to_etp_account=false;setComponentValues(this,v,true);Ext.getCmp(app_guarantee_cb_id).checked=!!v.guarantee_application;Ext.getCmp(contr_guarantee_cb_id).checked= !!v.guarantee_contract;Ext.getCmp(app_guarantee_bank_id).setValue(v.bank_guarantee==true);Ext.getCmp(app_guarantee_cb_id).setValue(v.guarantee_application_set==true);Ext.getCmp(advance_guarantee_cb_id).setValue(v.guarantee_advance!=null||v.guarantee_advance_type!=null);Ext.getCmp(warranty_guarantee_cb_id).setValue(v.guarantee_warranty!=null||v.guarantee_warranty_text!=null);if(Main.config.warranty_guarantee_period)Ext.getCmp(warranty_guarantee_period_cb_id).setValue(v.warranty_guarantee_period!=null); if(Main.config.warranty_payments)Ext.getCmp(warranty_payments_cb_id).setValue(v.warranty_payments!=null);if(v.lot_doc_requirements){this.items.each(function(c){if("lot_doc_requirements[]"==c.name)component.remove(c)});for(var i=0;i \u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435! \u041f\u0440\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u0439 \u0432 \u0415\u0418\u0421 \u0440\u0430\u0437\u043c\u0435\u0440 \u043e\u0434\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043d\u0435 \u0431\u043e\u043b\u0435\u0435 49 \u041c\u0431, \u0430 \u043e\u0431\u0449\u0438\u0439 \u043e\u0431\u044a\u0435\u043c \u0432\u0441\u0435\u0445 \u043f\u0440\u0438\u043b\u0430\u0433\u0430\u0435\u043c\u044b\u0445 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0442\u044c 500 \u041c\u0431 (\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u0415\u0418\u0421)."}, {name:this.name,xtype:"Application.components.multiuploadPanel",uploadHandler:RPC.Procedure.addFile,deleteHandler:RPC.Procedure.removeFile,id:files_id,simultaneousUpload:true,autoUpload:true,listeners:{beforeupload:function(cmp){cmp.uploadParams.procedure_id=component.procedure?component.procedure.procedure_id||0:0;cmp.uploadParams.type=1},uploadcomplete:function(result,action){if(result.success&&result.procedure_id&&component.procedure&&result.procedure_id!=component.procedure.procedure_id)component.procedure.fireEvent("idchanged", result.procedure_id)}}}]});if(component.module_type=="po")items.push({xtype:"fieldset",style:"margin-bottom: 10px; padding-top: 8px;",items:[{html:"\u0414\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0439\u0442\u0435 \u0438\u0445 \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u043e\u0440\u043c\u044b \u043d\u0438\u0436\u0435. \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0444\u0430\u0439\u043b\u043e\u0432 \u043d\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043e."}, {name:this.name,xtype:"Application.components.multiuploadPanel",uploadHandler:RPC.Procedure.addFile,deleteHandler:RPC.Procedure.removeFile,comboDescr:true,id:new_files_id,simultaneousUpload:true,autoUpload:true,disabled:component.isDisabled?component.isDisabled:false,listeners:{beforeupload:function(cmp){cmp.uploadParams.procedure_id=component.procedure?component.procedure.procedure_id||0:0;cmp.uploadParams.type=1},uploadcomplete:function(result,action){if(result.success&&result.procedure_id&&component.procedure&& result.procedure_id!=component.procedure.procedure_id)component.procedure.fireEvent("idchanged",result.procedure_id)}}}]});items.push({xtype:"fieldset",hidden:!Main.config.lot_doc_deadline&&!Main.config.lot_doc_providing_procedure&&!Main.config.lot_doc_payment_for_copy&&!Main.config.lot_doc_rights_duties&&!Main.config.lot_doc_site_url,labelWidth:500,defaults:{anchor:"100%"},items:[{fieldLabel:"\u0421\u0440\u043e\u043a \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438", border:false,hidden:!Main.config.lot_doc_deadline},{xtype:"textarea",name:"doc_deadline",hideLabel:true,hidden:!Main.config.lot_doc_deadline},{fieldLabel:"\u041f\u043e\u0440\u044f\u0434\u043e\u043a \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438",border:false,hidden:!Main.config.lot_doc_providing_procedure},{xtype:"textarea",name:"doc_providing_procedure",hideLabel:true,hidden:!Main.config.lot_doc_providing_procedure}, {fieldLabel:"\u041f\u043b\u0430\u0442\u0430 \u0437\u0430 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043f\u0438\u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043d\u0430 \u0431\u0443\u043c\u0430\u0436\u043d\u043e\u043c \u043d\u043e\u0441\u0438\u0442\u0435\u043b\u0435",border:false,hidden:!Main.config.lot_doc_payment_for_copy},{xtype:"textarea",name:"doc_payment_for_copy",hideLabel:true,hidden:!Main.config.lot_doc_payment_for_copy}, {fieldLabel:"\u041f\u0440\u0430\u0432\u0430 \u0438 \u043e\u0431\u044f\u0437\u0430\u043d\u043d\u043e\u0441\u0442\u0438",border:false,hidden:!Main.config.lot_doc_rights_duties},{xtype:"textarea",name:"doc_rights_duties",hideLabel:true,hidden:!Main.config.lot_doc_rights_duties},{fieldLabel:"\u041e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0430\u0439\u0442, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f", border:false,hidden:!Main.config.lot_doc_site_url},{xtype:"textfield",name:"doc_site_url",hideLabel:true,hidden:!Main.config.lot_doc_site_url}]});Ext.apply(this,{bodyCssClass:"subpanel-top-padding",items:items});Application.components.auctiondocForm.superclass.initComponent.call(this)}});Ext.define("Application.components.contragentsSelectForm",{extend:"Ext.Panel",emptyText:"\u0417\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u044b \u043d\u0435 \u0432\u0441\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u043b\u044f",showEmailField:true,delete_enabled:false,email_unset:false,initComponent:function(){this.error_panel_id=Ext.id();this.add_button_id=Ext.id();var component=this;function validate(){if(!component.inValidation){component.inValidation= true;component.isValid();component.inValidation=false}}function onBlur(f){var panel=f.findParentByType("panel");if(!panel)return;var v={};var inn=panel.getPanel("inn");var kpp=panel.getPanel("kpp");if(!inn||!kpp||!inn.isValid()||!kpp.isValid())return;inn=inn.getValue();kpp=kpp.getValue();if(panel.lastInn==inn&&panel.lastKpp==kpp)return;var search={limit:1,inn:inn};if(kpp)search.kpp=kpp;RPC.Company.search(search,function(resp){var email=panel.getPanel("email");if(!email)return;panel.lastInn=inn;panel.lastKpp= kpp;if(resp&&resp[1]&&resp[1].rowid){email.setRawValue(resp[1].full_name);panel.autoSetEmail=true;email.disable()}else{if(panel.autoSetEmail)email.setValue("");panel.autoSetEmail=false;email.enable();email.isValid()}})}this.itemTemplate={layout:"table",columns:4,itemPanel:true,cls:"spaced-bottom-shallow",items:[{xtype:"textfield",name:"full_name",ref:"fullNameCmp",cellCls:"width_300px",allowBlank:false,disabled:true,hidden:!component.showEmailField,blankText:this.emptyText,vtypeText:"\u041f\u043e\u043b\u0435 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043e \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e", width:"95%",listeners:{blur:validate,invalid:validate,valid:validate}},{cellCls:!!component.showEmailField?"width_100px":"width_400px",xtype:"textfield",name:"inn",ref:"innCmp",allowBlank:false,vtype:Main.config.validate_company_inn?"inn":null,minLength:10,maxLength:12,width:"90%",disabled:true,blankText:this.emptyText,minLengthText:"\u041f\u043e\u043b\u0435 \u0418\u041d\u041d \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043a\u043e\u0440\u043e\u0447\u0435 10 \u0437\u043d\u0430\u043a\u043e\u0432", maxLengthText:"\u041f\u043e\u043b\u0435 \u0418\u041d\u041d \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0434\u043b\u0438\u043d\u043d\u0435\u0435 12 \u0437\u043d\u0430\u043a\u043e\u0432",vtypeText:"\u041f\u043e\u043b\u0435 \u0418\u041d\u041d \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043e \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e",listeners:{blur:onBlur,invalid:validate,valid:validate}},{cellCls:!!component.showEmailField?"width_100px":"width_400px", xtype:"textfield",name:"kpp",ref:"kppCmp",allowBlank:true,minLength:9,maxLength:9,width:"90%",disabled:true,blankText:this.emptyText,minLengthText:"\u041f\u043e\u043b\u0435 \u041a\u041f\u041f \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043a\u043e\u0440\u043e\u0447\u0435 9 \u0437\u043d\u0430\u043a\u043e\u0432",maxLengthText:"\u041f\u043e\u043b\u0435 \u041a\u041f\u041f \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0434\u043b\u0438\u043d\u043d\u0435\u0435 9 \u0437\u043d\u0430\u043a\u043e\u0432", listeners:{blur:onBlur,invalid:validate,valid:validate}},{xtype:"textfield",name:"email",ref:"emailCmp",cellCls:"width_100px",allowBlank:false,disabled:true,hidden:!component.showEmailField,vtype:"email",blankText:this.emptyText,vtypeText:"\u041f\u043e\u043b\u0435 email \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043e \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e",width:"90%",listeners:{blur:validate,invalid:validate,valid:validate}},{cellCls:"width_100px",xtype:"button", text:"\u0423\u0434\u0430\u043b\u0438\u0442\u044c",iconCls:"icon-silk-delete",handler:function(b){this.remove(b.findParentByType("panel"));this.isValid()},scope:this},{xtype:"hidden",name:"contragent_id",ref:"idCmp"}],isValid:function(){var subcomponents=["inn","kpp","email"];var valid=true;for(var i=subcomponents.length-1;i>=0;i--){var p=this.getPanel(subcomponents[i]);if(p&&!p.isValid()){this.activeError=p.getActiveError();valid=false;break}}if(valid)this.activeError=false;return valid},getPanel:function(type){var p= this.find("name",type);return p&&p[0]?p[0]:null}};if(!this.items)this.items=[];this.extra_items_top=this.items.length+1;this.extra_items_bottom=2;this.items.unshift({html:this.title||"\u0423\u043a\u0430\u0436\u0438\u0442\u0435 \u0441\u043f\u0438\u0441\u043e\u043a \u043a\u043e\u043d\u0442\u0440\u0430\u0433\u0435\u043d\u0442\u043e\u0432",cls:"spaced-bottom"});this.items.push({layout:"table",columns:5,cls:"spaced-bottom-shallow",items:[{html:"\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438"+ REQUIRED_FIELD,cellCls:"x-inner-header width_300px",hidden:!component.showEmailField},{html:"\u0418\u041d\u041d"+REQUIRED_FIELD,cellCls:"x-inner-header "+(!!component.showEmailField?"width_100px":"width_400px")},{html:"\u041a\u041f\u041f (\u0434\u043b\u044f \u044e\u0440. \u043b\u0438\u0446)",cellCls:"x-inner-header "+(!!component.showEmailField?"width_100px":"width_400px")},{html:"Email",cellCls:"x-inner-header width_100px",hidden:!component.showEmailField},{cellCls:"width_100px"}]},{layout:"table", columns:5,items:[{colSpan:3,items:[{hidden:true,width:"100%",id:this.error_panel_id,cls:"x-form-invalid-msg",html:""}]},{cellCls:"width_100px",xtype:"button",text:"\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c",id:this.add_button_id,scope:this,iconCls:"icon-silk-add",handler:function(){this.addItem(true)}}]});Ext.apply(this,{header:false});this.addItem(true);Application.components.contragentsSelectForm.superclass.initComponent.call(this)},setAddButtonVisibile:function(visible){var button=Ext.getCmp(this.add_button_id); if(button)button.setVisible(visible)},addItem:function(editable,v,batch){editable=editable||false;var i=Ext.apply({},this.itemTemplate);i.items=[];for(var k=0;kthis.extra_items_top+this.extra_items_bottom)this.remove(this.extra_items_top+1);if(v)for(var i=0;i\n"); if(warn_fatal){Ext.Msg.alert("\u041e\u0448\u0438\u0431\u043a\u0430",warn);return}else Ext.Msg.confirm("\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435",warn+"
\n\u0412\u044b \u0443\u0432\u0435\u0440\u0435\u043d\u044b \u0447\u0442\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u0432\u043d\u0435\u0441\u0442\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f?",function(b){if("yes"==b)doSave()})}else doSave()},scope:this}];Application.components.lotEditForm.superclass.initComponent.call(this); var dates_panel=Ext.getCmp(this.ids.dates);if(dates_panel){dates_panel.disable();dates_panel.hide()}var datePanel;if(Main.config.multistep_support)datePanel=new Application.components.procedureBasicDatesMultiStep({title:"\u042d\u0442\u0430\u043f\u044b \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f",frame:true,style:"padding-left: 5px; padding-right: 5px;",id:this.formId});else datePanel=new Application.components.procedureBasicDates({title:"\u042d\u0442\u0430\u043f\u044b \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f", frame:true,style:"padding-left: 5px; padding-right: 5px;",id:this.formId});datePanel.relayEvents(this,["procedurechanged","blockStepsTillOrderNumber"]);var tabpanel=this.findByType("tabpanel");tabpanel[0].insert(0,datePanel);this.listeners=this.listeners||{};Ext.apply(this.listeners,{idchanged:function(id){component.lot_id=id},numberchanged:function(newnumber){component.lotNumber=newnumber}});if(this.value)autoSetValue(this);if(this.lot_id&&this.procedure_id)this.on("afterrender",function(){var params= {mask:true,mask_el:this.getEl(),scope:this};var p={lot_id:this.lot_id,procedure_id:this.procedure_id};performRPCCall(RPC.Lot.loaddraft,[p],params,function(resp){if(resp&&resp.success)this.setValues(resp.procedure);else if(resp)echoResponseMessage(resp)})},this,{once:true})},performSave:function(callback){var component=this;performRPCCall(RPC.Lot.save,[this.getValues()],null,function(result){if(result.success){if(result.procedure)component.setValues(result.procedure);if(Ext.isFunction(callback))callback(result)}else echoResponseMessage(result)})}, getValues:function(){var values={},dt,step;if(this.procedure_id)values.procedure_id=this.procedure_id;if(this.lot_id)values.id=this.lot_id;collectComponentValues(this,values,true);if(Main.config.multistep_support){if(values.steps.length)for(var c=0;c0&&v.lots&&v.lots[0])for(var i=0;i=10)return;var fields=this.getComponent(3); var fields_count=fields.items.getCount();for(var i=0;i\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: \u0414\u043d\u0435\u0439::\u041b\u0435\u0442"); else label.html="\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u043f\u0438\u0441\u043a\u0430 \u0447\u0435\u0440\u0435\u0437 ::
\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: \u0414\u043d\u0435\u0439::\u041b\u0435\u0442"}else{param_format.enable();if(label.body)label.body.update("\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430");else label.html="\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430"}if(param_format){if(this.getValue()== "REQ"){param_format.enable();param_value.disable()}else if(this.getValue()=="LOGICAL")param_format.disable();else{param_format.enable();param_value.enable()}param_format.setValue(null);var my_store=param_format.getStore();if(["MIN","MAX"].indexOf(this.getValue())>=0)my_store.filter("id",/[2,3,4,6]/);else my_store.clearFilter()}}}},{xtype:"combo",readOnly:this.specialField||this.readonlyFields,store:types,valueField:"id",displayField:"name",mode:"local",editable:false,triggerAction:"all",width:130, value:1,name:"format",fieldLabel:"\u0424\u043e\u0440\u043c\u0430\u0442",listeners:{select:function(){var p=this.findParentByType("panel");p.select_format(this.getValue())}}},{xtype:"panel",cellCls:"spaced-cell",itemId:"value_filed",items:[{xtype:"textfield",hidden:this.specialField||this.readonlyFields,disabled:this.specialField||this.readonlyFields,width:140,fieldLabel:"\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430",allowBlank:allowBlank, name:"value"},{xtype:"numberfield",width:140,fieldLabel:"\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430",name:"value",allowBlank:allowBlank,hidden:true,disabled:true},{xtype:"datefield",width:140,fieldLabel:"\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430",name:"value",allowBlank:allowBlank,hidden:true,disabled:true},{xtype:"datefield",format:"d.m.Y H:i",altFormats:"c|d.m.Y H:i|d.m.Y g:i", width:140,fieldLabel:"\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430",name:"value",allowBlank:allowBlank,hidden:true,disabled:true},{xtype:"combo",store:[[1,"\u0414\u0430"],[0,"\u041d\u0435\u0442"]],mode:"local",editable:false,triggerAction:"all",width:140,value:1,name:"value",fieldLabel:"\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430",allowBlank:allowBlank,hidden:true,disabled:true}, {xtype:"numberfield",width:140,fieldLabel:"\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430",name:"value",allowBlank:allowBlank,hidden:true,disabled:true}]},{xtype:"button",text:"\u0423\u0434\u0430\u043b\u0438\u0442\u044c",hidden:this.specialField||this.readonlyFields,handler:this.removeFn.createDelegate(this)},{html:"\u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430", cls:"subtitle",border:false,width:150},{html:"\u0442\u0438\u043f \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f",cls:"subtitle",border:false,width:120},{html:"\u0444\u043e\u0440\u043c\u0430\u0442",cls:"subtitle",border:false,width:120},{html:"\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430",hidden:this.specialField,readOnly:this.readonlyFields,cls:"subtitle",border:false,width:140,id:component.ids.value_field_label}]}});Ext.define("Application.components.procedureAccessLogGrid",{extend:"Ext.grid.Panel",lot_id:null,initComponent:function(){this.access_store=new Ext.data.DirectStore({autoLoad:true,autoDestroy:true,directFn:RPC.Procedure.accessLog,sortInfo:{field:"id",direction:"DESC"},baseParams:{lot_id:this.lot_id},idProperty:"id",totalProperty:"totalCount",paramsAsHash:true,remoteSort:true,root:"log",fields:["id","filename","registry_number","user_ip","inn",{name:"full_name",convert:function(v){return v||"\u0413\u043e\u0441\u0442\u044c"}}, {name:"title",convert:function(v,r){if(r.lot_document_id)return"\u0421\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430"+(r.filename?' '+r.filename.escapeHtml()+"":"");return"\u041f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u0438\u0437\u0432\u0435\u0449\u0435\u043d\u0438\u044f"}},{name:"date",convert:function(v){return parseDate(v)}}],listeners:{exception:storeExceptionHandler}}); var columns=[{header:"\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440",dataIndex:"id",hidden:true,sortable:true,width:20},{header:"\u0414\u0430\u0442\u0430",dataIndex:"date",renderer:Ext.util.Format.dateRenderer(this.lot_id?"d.m.Y H:i":"d.m.Y H:i:s"),hidden:false,sortable:true,width:40},{header:"\u041e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044f",dataIndex:"full_name",hidden:false,sortable:false},{header:"\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435", dataIndex:"title",hidden:false,sortable:false,width:60}];if(!this.lot_id&&isAdmin()){columns.splice(2,0,{header:"\u041f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430",dataIndex:"registry_number",sortable:true,width:40},{header:"\u0418\u041d\u041d",dataIndex:"inn",sortable:false,width:40});columns.push({header:"\u0418\u041f",dataIndex:"user_ip",sortable:true,width:40});this.tbar={xtype:"Application.components.searchToolbar",eventTarget:this,advancedSearch:[{xtype:"textfield",name:"registry_number", fieldLabel:"\u041f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430"},{xtype:"dateinterval",name:"date",format:"d.m.Y H:i:s",fieldLabel:"\u0414\u0430\u0442\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u044f",tillAlign:"date",width:150},{xtype:"textfield",name:"inn",fieldLabel:"\u0418\u041d\u041d \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438"},{xtype:"textfield",name:"user_ip",fieldLabel:"\u0418\u041f"}]}}Ext.apply(this,{store:this.access_store,loadMask:true,columns:columns,viewConfig:{forceFit:true}, bbar:renderPagingToolbar("\u0417\u0430\u043f\u0438\u0441\u0438",this.access_store,this.lot_id?25:100)});this.listeners=this.listeners||{};Ext.apply(this.listeners,{search:function(query,aq){aq=aq||{};aq.query=query;if(aq)for(var sp in aq){if(!aq.hasOwnProperty(sp))continue;this.access_store.setBaseParam(sp,aq[sp])}this.access_store.load()},scope:this});Application.components.procedureAccessLogGrid.superclass.initComponent.call(this)}});Ext.define("Application.components.procedureBasicDates",{extend:"Ext.Panel",autoHeight:true,initComponent:function(){var component=this;var procedure_type_id=Ext.id(),auction_step_id=Ext.id(),auction_app_stages_id=Ext.id(),auction_offers_delay_id=Ext.id(),date_published_id=Ext.id(),date_end_registration_id=Ext.id(),date_end_first_parts_review_id=Ext.id(),date_begin_auction_id=Ext.id(),date_applic_opened_id=Ext.id(),date_itog_id=Ext.id(),applic_checkbox_id=Ext.id(),time_begin_auction_id=Ext.id(),remoteId_id= Ext.id(),peretorg_possible_id=Ext.id(),commonfilepanel_id=Ext.id(),offers_step_min_id=Ext.id(),offers_step_max_id=Ext.id(),title_id=Ext.id(),private_access_id=Ext.id(),private_fieldset_id=Ext.id(),fieldset_documentation_id=Ext.id(),procedure_invitation_id=Ext.id();this.date_applic_opened_id=date_applic_opened_id;var only_auction_fields=[];var retrade_and_auction_fields=[date_begin_auction_id,time_begin_auction_id];var all_dates_fields=[date_end_registration_id,date_applic_opened_id,date_end_first_parts_review_id, date_begin_auction_id,time_begin_auction_id,date_itog_id];var date_fields={auction_up:[date_end_registration_id,date_end_first_parts_review_id,date_begin_auction_id,time_begin_auction_id],auction_down:[date_end_registration_id,date_end_first_parts_review_id,date_begin_auction_id,time_begin_auction_id,date_itog_id],auction:[date_end_registration_id,date_end_first_parts_review_id,date_begin_auction_id,time_begin_auction_id,date_itog_id],peretorg_reduc:[date_begin_auction_id,time_begin_auction_id],contest:[date_end_registration_id, date_applic_opened_id,date_end_first_parts_review_id,date_itog_id],peretorg_contest:[date_end_registration_id,date_end_first_parts_review_id,date_itog_id],quotation:[date_end_registration_id,date_applic_opened_id,date_itog_id],pricelist:[date_end_registration_id,date_itog_id],qualification:[date_end_registration_id,date_itog_id],paper_quotation:[date_end_registration_id,date_applic_opened_id,date_itog_id]};component.typesStore=Application.models.Procedure.getTypesStoreFromRPC();this.holidays=null; this.workdays=null;function setDisabledDates(){var iterator=0;var start=new Date;var disabled_dates=[];while(true){var tmpDate=start.add(Date.DAY,iterator);if(component.holidays&&component.holidays.indexOf(tmpDate.format("d.m.Y"))!=-1||component.workdays&&tmpDate.getDay()%6==0&&component.workdays.indexOf(tmpDate.format("d.m.Y"))==-1)disabled_dates.push(tmpDate.format("d.m.Y"));++iterator;if(iterator>100)break}Ext.getCmp(date_begin_auction_id).setDisabledDates(disabled_dates)}this.addEvents("procedurechanged"); this.addEvents("stageschanged");this.addEvents("peretorg");this.addEvents("peretorg_init");this.addEvents("onEditing");var notifier=function(event){return function(){if(this.isValid()){var cur_value=this.getValue();this.fireEvent(event,cur_value)}}};Ext.apply(this,{bodyCssClass:"subpanel-top-padding",items:[{title:"\u0421\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b",xtype:"fieldset",labelWidth:400,items:[{fieldLabel:"\u0414\u0430\u0442\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b"+ REQUIRED_FIELD,xtype:"Application.components.dateField",id:date_published_id,format:"d.m.Y",altFormats:"c|d.m.Y H:i:s|d.m.Y H:i",anchor:null,name:"date_published",width:200,value:now(),minValue:new Date,hidden:this.hideDatePublished?true:false,listeners:{beforerender:function(){this.addEvents("typeComboLoaded")},select:function(){Ext.getCmp(date_end_registration_id).makeDateDisabling(this.getValue(),"applic_publish",component.procedureDateSettings)},valueFilled:function(v){Ext.getCmp(date_end_registration_id).makeDateDisabling(v, "applic_publish",component.procedureDateSettings)},typeComboLoaded:function(){Ext.getCmp(date_end_registration_id).makeDateDisabling(this.getValue(),"applic_publish",component.procedureDateSettings)}}},{fieldLabel:"\u0414\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043c\u044f \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u0441\u0440\u043e\u043a\u0430 \u043f\u043e\u0434\u0430\u0447\u0438 \u0437\u0430\u044f\u0432\u043e\u043a, \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0439"+ REQUIRED_FIELD,xtype:"Application.components.dateField",id:date_end_registration_id,format:"d.m.Y H:i",anchor:null,name:"date_end_registration",width:200,listeners:{beforerender:function(){this.addEvents("regDateSelected")},select:function(){var cur_value=this.getValue();var date=(new Date(this.getValue())).add(Date.HOUR,21);this.setValue(date.format("d.m.Y H:i"))},change:notifier("regDateSelected"),valueFilled:function(v){this.fireEvent("regDateSelected",v)}}},{fieldLabel:"\u0414\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043c\u044f \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u0441\u0440\u043e\u043a\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 \u0432\u0441\u043a\u0440\u044b\u0442\u0438\u044f \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u043e\u0432"+ REQUIRED_FIELD,xtype:"Application.components.dateField",id:date_applic_opened_id,format:"d.m.Y H:i",anchor:null,name:"date_applic_opened",width:200,listeners:{beforerender:function(){if(Main.config.applic_opened_visible){this.addEvents("regDateSelected");this.relayEvents(Ext.getCmp(date_end_registration_id),["regDateSelected"])}},regDateSelected:function(v){this.makeDateDisabling(v,"applic_opened",component.procedureDateSettings)},select:function(){var cur_value=this.getValue();var date=(new Date(cur_value)).add(Date.HOUR, 12);this.setValue(date.format("d.m.Y H:i"))},change:notifier("reviewBaseDateSelected"),valueFilled:function(v){this.fireEvent("reviewBaseDateSelected",v)}}},{fieldLabel:"\u0414\u0430\u0442\u0430 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u0441\u0440\u043e\u043a\u0430 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044f \u0437\u0430\u044f\u0432\u043e\u043a, \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0439"+REQUIRED_FIELD+":",labelSeparator:"",xtype:"Application.components.dateField", id:date_end_first_parts_review_id,format:"d.m.Y H:i",anchor:null,name:"date_end_first_parts_review",width:200,listeners:{beforerender:function(){this.addEvents("regDateSelected");this.addEvents("reviewBaseDateSelected");this.addEvents("beginBaseDateSelected");this.addEvents("itogBaseDateSelected");this.relayEvents(Ext.getCmp(date_end_registration_id),["regDateSelected"]);this.relayEvents(Ext.getCmp(date_applic_opened_id),["reviewBaseDateSelected"])},regDateSelected:function(v){if(!Main.config.applic_opened_visible)if(component.procedure_type_id== Application.models.Procedure.type_ids.contest){v=component.calculateDateOpened(v);v=v.add(Date.MINUTE,3)}this.makeDateDisabling(v,"end_firstparts",component.procedureDateSettings)},reviewBaseDateSelected:function(v){this.makeDateDisabling(v,"end_firstparts",component.procedureDateSettings)},select:function(){var date=new Date(this.getValue());date=date.add(Date.HOUR,23);date=date.add(Date.MINUTE,59);this.setValue(date)},change:function(){if(!this.isValid())return;var date=this.getValue();if(component.procedure_type_id== Application.models.Procedure.type_ids.auction_up||component.procedure_type_id==Application.models.Procedure.type_ids.auction_down)this.fireEvent("beginBaseDateSelected",date);else this.fireEvent("itogBaseDateSelected",date)},valueFilled:function(v){if(component.procedure_type_id==Application.models.Procedure.type_ids.auction_up||component.procedure_type_id==Application.models.Procedure.type_ids.auction_down)this.fireEvent("beginBaseDateSelected",v);else this.fireEvent("itogBaseDateSelected",v)}}}, {fieldLabel:"\u0414\u0430\u0442\u0430 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f (\u0434\u043b\u044f \u0430\u0443\u043a\u0446\u0438\u043e\u043d\u043e\u0432)"+REQUIRED_FIELD+":",labelSeparator:"",xtype:"Application.components.dateField",id:date_begin_auction_id,format:"d.m.Y",altFormats:"c|d.m.Y H:i:s|d.m.Y H:i",anchor:null,name:"date_begin_auction",width:200,listeners:{beforerender:function(){this.addEvents("beginBaseDateSelected");this.addEvents("itogBaseDateSelected");this.relayEvents(Ext.getCmp(date_end_first_parts_review_id), ["beginBaseDateSelected"])},beginBaseDateSelected:function(v){this.makeDateDisabling(v,"begin_auction",component.procedureDateSettings)},change:notifier("itogBaseDateSelected"),valueFilled:function(v){this.fireEvent("itogBaseDateSelected",v)}}},{fieldLabel:"\u0412\u0440\u0435\u043c\u044f \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f"+REQUIRED_FIELD+":",labelSeparator:"",xtype:"timefield",id:time_begin_auction_id,format:"H:i",altFormats:"c|d.m.Y H:i:s|d.m.Y H:i",anchor:null,name:"time_begin_auction", width:200},{fieldLabel:"\u0414\u0430\u0442\u0430 \u043f\u043e\u0434\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0438\u0442\u043e\u0433\u043e\u0432"+REQUIRED_FIELD,xtype:"Application.components.dateField",id:date_itog_id,format:"d.m.Y",anchor:null,name:"date_end_second_parts_review",width:200,listeners:{beforerender:function(){this.addEvents("itogBaseDateSelected");this.addEvents("regDateSelected");this.relayEvents(Ext.getCmp(date_end_registration_id),["regDateSelected"]);this.relayEvents(Ext.getCmp(date_end_first_parts_review_id), ["itogBaseDateSelected"]);this.relayEvents(Ext.getCmp(date_begin_auction_id),["itogBaseDateSelected"])},regDateSelected:function(v){if(!Main.config.applic_opened_visible)if(component.procedure_type_id==Application.models.Procedure.type_ids.quotation){v=component.calculateDateOpened(v);v=v.add(Date.MINUTE,3)}this.makeDateDisabling(v,"end_secondparts",component.procedureDateSettings)},itogBaseDateSelected:function(v){this.makeDateDisabling(v,"end_secondparts",component.procedureDateSettings)},select:function(){var date= (new Date(this.getValue())).add(Date.HOUR,23);date=date.add(Date.MINUTE,59);this.setValue(date)}}}]}],listeners:{peretorg:function(frm,stage){this.stage=stage;this.frm=frm;if(stage>0&&frm=="dotorg")Ext.getCmp(applic_checkbox_id).show();else Ext.getCmp(applic_checkbox_id).hide()},peretorg_init:function(){var typesStore=Application.models.Procedure.getPeretorgTypesStore();typesStore.load();var cmp=Ext.getCmp(procedure_type_id);if(cmp)cmp.store=typesStore}},getValues:function(){var dt=null;var v={organizer_contragent_id:this.organizer_contragent_id}; collectComponentValues(this,v,true);v.procedure_type=component.procedure_type_id;if(v.time_begin_auction&&v.date_begin_auction){var time=v.time_begin_auction.split(":");v.date_begin_auction.setHours(time[0]);v.date_begin_auction.setMinutes(time[1]);v.date_begin_auction.setSeconds(0);v.date_begin_auction.setMilliseconds(0);v.time_begin_auction=true}else v.time_begin_auction=false;if(v.date_end_second_parts_review)v.date_end_second_parts_review=v.date_end_second_parts_review.add(Date.MINUTE,23*60+59); if(!Main.config.applic_opened_visible)if(v.procedure_type==Application.models.Procedure.type_ids.contest||v.procedure_type==Application.models.Procedure.type_ids.quotation){dt=Ext.getCmp(date_end_registration_id).getValue();v.date_applic_opened=component.calculateDateOpened(dt)}if(v.procedure_type==Application.models.Procedure.type_ids.peretorg_reduc){v.offers_wait_time=60;v.offers_step_min=1E-4;v.offers_step_max=100}return v},calculateDateOpened:function(dt){if(typeof dt=="string")dt=parseDate(dt); dt.setHours(0);dt.setMinutes(0);dt.setSeconds(1);dt.setMilliseconds(0);dt=dt.add(Date.DAY,1);dt=dt.add(Date.MINUTE,23*60+59);return dt},setValues:function(v){if(v.date_begin_auction&&v.time_begin_auction){v.date_begin_auction=parseDate(v.date_begin_auction);v.time_begin_auction=v.date_begin_auction.format("H:i");v.date_begin_auction.setHours(0);v.date_begin_auction.setMinutes(0);v.date_begin_auction.setSeconds(0);v.date_begin_auction.setMilliseconds(0)}if(!v.time_begin_auction)v.time_begin_auction= null;if(v.date_published){var date_now=new Date;var saved_date=parseDate(v.date_published);Ext.getCmp(date_published_id).setMinValue(date_now-1){var labelEl=Ext.DomQuery.selectNode('label[for="'+this.date_applic_opened_id+'"]');if(labelEl)labelEl.innerHTML="\u0414\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043c\u044f \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u0441\u0440\u043e\u043a\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0437\u0430\u044f\u0432\u043a\u0430\u043c"+ REQUIRED_FIELD}setComponentValues(this,v,true);if(v.procedure_type)this.fireEvent("procedurechanged",Number(v.procedure_type));if(v.application_stages)this.fireEvent("stageschanged",Number(v.application_stages));if(null!=v.date_published&&v.version&&v.version>=1){var cmp=Ext.getCmp(procedure_type_id);if(cmp)cmp.disable();this.fireEvent("onEditing")}}});this.listeners=this.listeners||{};this.procedureTypeChanged=function(p,steps,status){var auc_visible=false;var auc_and_retrade_visible=false;var visible= false;var item,i;var type=Application.models.Procedure.type_ids[""+p];var ptypes=Application.models.Procedure.type_ids;var pgroups=Application.models.Procedure.groups;if(pgroups.auctions.indexOf(p)>=0){auc_visible=true;auc_and_retrade_visible=true}if(pgroups.retrades.indexOf(p)>=0)auc_visible=false;for(i=0;i=0)visible=true;else visible=false;item=Ext.getCmp(all_dates_fields[i]);item.setDisabled(!visible);item.setVisible(visible)}if(!Main.config.applic_opened_visible)if(p==Application.models.Procedure.type_ids.contest||p==Application.models.Procedure.type_ids.quotation){Ext.getCmp(date_applic_opened_id).setVisible(false); Ext.getCmp(date_applic_opened_id).setDisabled(false)}var date_end_first_parts_review_text="\u0414\u0430\u0442\u0430 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u0441\u0440\u043e\u043a\u0430 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044f \u0437\u0430\u044f\u0432\u043e\u043a, \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0439"+REQUIRED_FIELD;var date_begin_auction_text="\u0414\u0430\u0442\u0430 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f (\u0434\u043b\u044f \u0430\u0443\u043a\u0446\u0438\u043e\u043d\u043e\u0432)"+ REQUIRED_FIELD;var time_begin_auction_text="\u0412\u0440\u0435\u043c\u044f \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f"+REQUIRED_FIELD;if(p==PROCEDURE_TYPE_AUC_DESC){date_end_first_parts_review_text="\u0414\u0430\u0442\u0430 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u0441\u0440\u043e\u043a\u0430 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0432\u044b\u0445 \u0447\u0430\u0441\u0442\u0435\u0439 \u0437\u0430\u044f\u0432\u043e\u043a"+ REQUIRED_FIELD;date_begin_auction_text="\u0414\u0430\u0442\u0430 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0440\u0435\u0434\u0443\u043a\u0446\u0438\u043e\u043d\u0430"+REQUIRED_FIELD;time_begin_auction_text="\u0412\u0440\u0435\u043c\u044f \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0440\u0435\u0434\u0443\u043a\u0446\u0438\u043e\u043d\u0430"+REQUIRED_FIELD}function changeLabelText(field_id,label_text){var field=Ext.getCmp(field_id);if(field.label)field.label.update(label_text+ ":");else field.fieldLabel=label_text+":"}changeLabelText(date_end_first_parts_review_id,date_end_first_parts_review_text);changeLabelText(date_begin_auction_id,date_begin_auction_text);changeLabelText(time_begin_auction_id,time_begin_auction_text);if(status)component.procedure_status=status;if(status==Application.models.Procedure.statuses.second_parts&&Main.config.addstep_support)changeLabelText(date_end_registration_id,"\u0414\u0430\u0442\u0430 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u0441\u0440\u043e\u043a\u0430 \u0443\u0442\u043e\u0447\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u044f\u0432\u043e\u043a, \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0439"+ REQUIRED_FIELD);if(!component.holidays)performRPCCall(RPC.Reference.holidays,[],{wait_disable:true},function(resp){component.holidays=resp.holidays;component.workdays=resp.workdays;setDisabledDates()});else setDisabledDates();this.doLayout();component.typesStore.load(function(){component.procedureDateSettings=component.typesStore.getById(p).data});component.procedure_type_id=p};Ext.apply(this.listeners,{procedurechanged:this.procedureTypeChanged,blockStepsTillOrderNumber:this.onBlockStepsTillOrderNumber, scope:this});Application.components.procedureBasicDates.superclass.initComponent.call(this);autoSetValue(this);this.fireEvent("procedurechanged",2)},onBlockStepsTillOrderNumber:function(num){this.getComponent(0).items.each(function(item,i){if(i= 1){Ext.getCmp(procedure_type_id).disable();this.fireEvent("onEditing")}},changeLabelText:function(field_id,label_text){var field=Ext.getCmp(field_id);if(!field)return;if(field.label)field.label.update(label_text+":");else field.fieldLabel=label_text+":"}});this.listeners=this.listeners||{};this.procedureTypeChanged=function(p,steps,status){var auc_visible=false;var auc_and_retrade_visible=false;var visible=false;var item,i,record;component.procedure_type_id=p;component.typesStore.load(function(resp){var component= this;component.procedureDateSettings=component.typesStore.getById(p).data});if(!steps||!steps.length){var type=Application.models.Procedure.type_ids[""+p];steps=Application.models.Procedure.getType(p).steps}component.stepGridStore.loadData(Application.models.Procedure.prepareStepsData(steps,status,p));this.doLayout()};Ext.apply(this.listeners,{procedurechanged:this.procedureTypeChanged,scope:this});this.organizer_contragent_id=Main.contragent.id;Application.components.procedureBasicDatesMultiStep.superclass.initComponent.call(this); autoSetValue(this);this.fireEvent("procedurechanged",2)}});Ext.define("Application.components.procedureBasicFormMultiStep",{extend:"Ext.form.Panel",autoHeight:true,parent:null,with_prequalification:false,with_preregistration:false,with_notice_discussion:false,with_first_parts_discussion:false,with_add_price_registration:false,with_contract_decision:true,price_request_similar_procedure:[PROCEDURE_PRICE_REQUEST,PROCEDURE_CONCURRENT_PROCEDURE],setDatePublishedEditable:function(editable){var component=this;var cmp=Ext.getCmp(component["ids"]["date_published_id"]); if(cmp)cmp.setReadOnly(!editable)},initComponent:function(){var component=this;component.ids=initIds(["date_published_id","properties_fieldset_id","changes_fieldset","steps_fieldset_id","documents_fieldset_id","additional_steps_combo_id","skip_fees_checkbox","auction_app_stages_id","second_stage_access_step_id"]);var procedure_type_id=Ext.id(),auction_step_id=Ext.id(),auction_offers_delay_id=Ext.id(),applic_checkbox_id=Ext.id(),remoteId_id=Ext.id(),peretorg_possible_id=Ext.id(),commonfilepanel_id= Ext.id(),offers_step_min_id=Ext.id(),offers_step_max_id=Ext.id(),title_id=Ext.id(),private_access_id=Ext.id(),price_increase_id=Ext.id(),paper_form_reqs_id=Ext.id(),send_oos_checkbox_id=Ext.id(),skip_before_contract_checkbox_id=Ext.id(),purchase_method_id=Ext.id(),twostep_checkbox_id=Ext.id(),prequalification_checkbox_id=Ext.id(),total_steps_id=Ext.id(),private_fieldset_id=Ext.id(),step_reduction_id=Ext.id(),step_auction_id=Ext.id(),middle_small_business_id=Ext.id(),choose_contragent_id=Ext.id(), procedure_find_combo_id=Ext.id(),not_dishonest_id=Ext.id();var max_uploadsize=Main.config.upload_max_size?Main.config.upload_max_size:MAX_UPLOAD_SIZE;var only_auction_fields=[auction_step_id,auction_offers_delay_id,component.ids.auction_app_stages_id];component.typesStore=Application.models.Procedure.getTypesStoreFromRPC();component.procedure_id=component.parent.procedure_id||null;component.start_price_of_lot=0;component.date_published_fld=new Application.components.dateField({fieldLabel:"\u0414\u0430\u0442\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b"+ REQUIRED_FIELD,id:this.ids.date_published_id,format:!isEmpty(component.frm)?"d.m.Y H:i":"d.m.Y",altFormats:"c|d.m.Y H:i:s|d.m.Y H:i",anchor:null,name:"date_published",width:200,value:now(),minValue:new Date});component.additional_steps_combo_fld=new Ext.ux.form.CheckboxCombo({name:"assigned_additional_steps",id:component.ids["additional_steps_combo_id"],fieldLabel:"\u0421 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435\u043c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u044d\u0442\u0430\u043f\u0430", valueField:"id",displayField:"name",emptyText:"\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u044d\u0442\u0430\u043f",mode:"local",anchor:"100%",store:new Ext.data.ArrayStore({fields:["id","name","disabled"],data:[["STEP_NOTICE_DISCUSSION","\u041e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0438\u0437\u0432\u0435\u0449\u0435\u043d\u0438\u044f \u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438"], ["STEP_FIRST_PARTS_DISCUSSION","\u041e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u044b\u0445 \u0447\u0430\u0441\u0442\u0435\u0439 \u0437\u0430\u044f\u0432\u043e\u043a"],["STEP_ADD_PRICE_REGISTRATION","\u041f\u0440\u0438\u0435\u043c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0446\u0435\u043d\u043e\u0432\u044b\u0445 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0439"]]}),listeners:{changed:function(cmp, values){var qual_checked=values.indexOf("STEP_QUALIFICATION")>-1;var first_parts_discussion_checked=values.indexOf("STEP_FIRST_PARTS_DISCUSSION")>-1;var notice_discussion_checked=values.indexOf("STEP_NOTICE_DISCUSSION")>-1;var with_add_price_registration=values.indexOf("STEP_ADD_PRICE_REGISTRATION")>-1;cmp.getStore().each(function(store_item){if(store_item.get("id")=="STEP_NOTICE_DISCUSSION")store_item.set("disabled",!!first_parts_discussion_checked);if(store_item.get("id")=="STEP_FIRST_PARTS_DISCUSSION")store_item.set("disabled", !!notice_discussion_checked);if(store_item.get("id")=="STEP_NOTICE_DISCUSSION"&&component.procedure_type_id==PROCEDURE_TYPE_PURCHASE_WITH_GRADE)store_item.set("disabled",true);if(store_item.get("id")=="STEP_FIRST_PARTS_DISCUSSION"&&component.procedure_type_id==PROCEDURE_TYPE_PURCHASE_WITH_GRADE)store_item.set("disabled",true)});var steps=component.steps||Application.models.Procedure.getType(""+component.procedure_type_id).steps;if(Application.models.Procedure.groups.support_multistep.indexOf(component.procedure_type_id)>= 0&&qual_checked){component.with_prequalification=true;if(Main.config.preregistration_inprequalification_support)component.with_preregistration=true}else{component.with_prequalification=false;if(Main.config.preregistration_inprequalification_support)component.with_preregistration=false}component.with_first_parts_discussion=!!first_parts_discussion_checked;component.with_notice_discussion=!!notice_discussion_checked;component.with_add_price_registration=!!with_add_price_registration;component.fireEvent("updateSteps", steps);component.fireEvent("stageschanged",Ext.getCmp(component.ids.auction_app_stages_id).getValue());cmp.reconfigure()},changeitem:function(cmp,val){var prepareValues=function(){var result=[];if(!isEmpty(val))Ext.each(val,function(val_item){result.push(typeof val_item=="object"?val_item.getRawValue():val_item)});return result};var values=prepareValues();cmp.fireEvent("changed",cmp,values)}}});component.stepGridStore=new Ext.data.JsonStore({autoDestroy:true,autoLoad:false,idProperty:"id",autoSave:false, paramsAsHash:true,fields:["id","order_number","step_id","date_start","date_end","time_start","time_end","order_conduct","order_location","disabled"],data:Application.models.Procedure.prepareStepsData(Application.models.Procedure.getType("2").steps,undefined,2,{with_preregistration:component.with_preregistration,with_prequalification:component.with_prequalification,with_notice_discussion:component.with_notice_discussion,with_first_parts_discussion:component.with_first_parts_discussion,with_final_registration:component.with_final_registration, with_add_price_registration:component.with_add_price_registration})});this.is_electronic=true;this.startDefinition=false;this.addEvents("procedurechanged");this.addEvents("stageschanged");this.addEvents("peretorg");this.addEvents("peretorg_init");this.addEvents("onEditing");this.addEvents("startpricechanged");this.addEvents("purchaseMethodChange");this.addEvents("disableFieldsEditing");this.addEvents("updateSteps");this.addEvents("changeOosStateCheckbox");this.addEvents("changeProcedureType");function PriceToNumber(str){var filter= /^[\s,0-9]+$/i;if(!filter.test(str))return false;v=str.replace(/\s/g,"");v=v.replace(",",".");v=parseFloat(v);if(v=="NaN")return false;return v}var ossCheckHandler=function(cmp){var isChecked=cmp.getValue();var purchase_method=Ext.getCmp(purchase_method_id);purchase_method.allowBlank=!isChecked;if(purchase_method.rendered)purchase_method.validate();this.fireEvent("oosstate",isChecked)}.createDelegate(this);Ext.apply(this,{labelWidth:300,defaults:{anchor:"100%",defaults:{border:false,anchor:"100%", labelWidth:300,allowBlank:false}},bodyCssClass:"subpanel",items:[{xtype:"panel",bodyStyle:"padding: 10px 5px 5px 0",layout:"hbox",hidden:!isContragentOosUser(),layoutConfig:{pack:"end"},items:[{xtype:"Application.components.linkButton",ref:"../createFromPlanLinkCmp",text:"\u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u043b\u0430\u043d\u0430 \u0437\u0430\u043a\u0443\u043f\u043e\u043a",listeners:{click:function(){if(this.disabled)return;var root_cmp= component.parent;var subject_tab=root_cmp.getLotSubTabByName(1,"subject");root_cmp.activate(root_cmp.items.get(1));root_cmp.items.get(1).items.get(0).activate(subject_tab);subject_tab.fireEvent("openpurchaseplandialog")}}}]},{xtype:"fieldset",title:"\u0421\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435",items:[{fieldLabel:"\u0424\u043e\u0440\u043c\u0430 \u0442\u043e\u0440\u0433\u043e\u0432",xtype:"Application.components.combo",id:procedure_type_id, store:component.typesStore,hiddenRecordField:"hidden",displayField:"name",valueField:"id",editable:false,triggerAction:"all",emptyText:"\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0444\u043e\u0440\u043c\u0443 \u0442\u043e\u0440\u0433\u043e\u0432",hiddenName:"procedure_type",name:"procedure_type",listeners:{select:function(combo,value){var settings=component.typesStore.getById(value.data.id);if(settings&&settings["data"]){component.procedureDateSettings=settings.data;Ext.getCmp(component.ids.date_published_id).fireEvent("typeComboLoaded"); component.fireEvent("procedurechanged",value.data.id)}component.changeVisibilityAdditionalStep()},beforerender:function(combo){component.typesStore.load({callback:function(){combo.setValue(Main.config.basic_proc_type);var settings=component.typesStore.getById(Main.config.basic_proc_type);if(settings&&settings["data"]){component.procedureDateSettings=settings.data;Ext.getCmp(component.ids.date_published_id).fireEvent("typeComboLoaded")}}})}}},{boxLabel:"\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u043f\u0435\u0440\u0435\u0442\u043e\u0440\u0436\u043a\u0438", xtype:"checkbox",name:"peretorg_possible",id:peretorg_possible_id,value:false,hidden:!Main.config.show_peretorg_possible_field},{boxLabel:"\u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430 \u0434\u043b\u044f \u0441\u0443\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043c\u0430\u043b\u043e\u0433\u043e \u0438 \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u043f\u0440\u0435\u0434\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430",xtype:"checkbox",name:"middle_small_business", id:middle_small_business_id,value:false,hidden:true},{fieldLabel:"\u041d\u043e\u043c\u0435\u0440 \u0438\u0437\u0432\u0435\u0449\u0435\u043d\u0438\u044f",html:"\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438",name:"registry_number"},{fieldLabel:"\u041d\u043e\u043c\u0435\u0440 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b",name:"remote_id",id:remoteId_id,html:" ",hidden:true}, {xtype:"textarea",name:"title",height:50,id:title_id,autoScroll:true,maxLength:2E3,fieldLabel:"\u041d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b"+REQUIRED_FIELD},{xtype:"Application.components.combo",fieldLabel:"\u0412\u0430\u043b\u044e\u0442\u0430 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b",store:getCurrencyStore(),valueField:"id",displayField:"description",name:"currency",hiddenName:"currency_val",value:this.value? this.value.currency:810,mode:"local",editable:false,triggerAction:"all",renderer:function(values){return Ext.util.Format.countryFlag(values.alpha2||values.alpha3)+" "+values.description},listeners:{beforerender:function(){var st=this.getStore();st.on("load",function(){this.setValue(this.value)},this,{once:true})}}},{fieldLabel:"\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u0432 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u0435, \u043d\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u043e\u0435 \u0441 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435\u043c \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u0437\u0430\u043a\u0443\u043f\u043a\u0438", xtype:"checkbox",name:"skip_before_contract",id:skip_before_contract_checkbox_id,hidden:true,listeners:{check:function(cmp,checked){component.with_contract_decision=!checked;component.fireEvent("updateSteps")}}},{fieldLabel:"\u041f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435 \u043d\u0430 \u0415\u0418\u0421",xtype:"checkbox",name:"send_to_oos",id:send_oos_checkbox_id,hidden:!Main.contragent.oos_send, disabled:!Main.contragent.oos_send,checked:Main.contragent.oos_send,listeners:{afterrender:ossCheckHandler,check:ossCheckHandler}},{xtype:"Application.components.combo",fieldLabel:"\u0421\u043f\u043e\u0441\u043e\u0431 \u0437\u0430\u043a\u0443\u043f\u043a\u0438 \u043f\u043e \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0443 \u0415\u0418\u0421",store:getPurchaseMethodStore(true),id:purchase_method_id,hidden:!isContragentOosUser(),valueField:"code",displayField:"name", name:"purchase_method_code",hiddenName:"purchase_method_code",mode:"local",editable:false,customerDisabled:false,triggerAction:"all",listWidth:800,tooltipTpl:"{name}",qtipConfig:{html:"\u041f\u0440\u0438 \u0432\u044b\u0431\u043e\u0440\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0437\u0430\u043a\u0443\u043f\u043a\u0438 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u0431\u044b\u043b \u0432\u043a\u043b\u044e\u0447\u0435\u043d \u0412\u0430\u043c\u0438 \u043d\u0430 \u0415\u0418\u0421 \u0432 \u041f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043e \u0437\u0430\u043a\u0443\u043f\u043a\u0430\u0445. \u041f\u043e\u0441\u043b\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u0435\u0440\u0441\u0438\u0438 \u0415\u0418\u0421 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u0441\u0442\u0430\u043b\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0430, \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u0441\u043f\u043e\u0441\u043e\u0431 \u0437\u0430\u043a\u0443\u043f\u043a\u0438 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432 \u041f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u043e \u0437\u0430\u043a\u0443\u043f\u043a\u0430\u0445. "+ "\u0421\u043b\u0435\u0432\u0430 \u043e\u0442 \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u0432\u044b\u0432\u0435\u0434\u0435\u043d \u0435\u0433\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0438 \u043a\u043e\u0434 \u043d\u0430 \u0415\u0418\u0421, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0437\u043d\u0430\u0447\u043e\u043a (+) \u0438\u043b\u0438 (-), \u0447\u0442\u043e\u0431\u044b \u0412\u044b \u043c\u043e\u0433\u043b\u0438 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435. "+ "\u041f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u0438\u0434\u0435\u0442\u044c \u0432 \u0441\u043f\u0440\u0430\u0432\u043e\u0447\u043d\u0438\u043a\u0435 \u0421\u043f\u043e\u0441\u043e\u0431\u044b \u0437\u0430\u043a\u0443\u043f\u043a\u0438 \u0432 \u041b\u041a \u043d\u0430 \u0415\u0418\u0421 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043b\u043e\u043d\u043a\u0435. \u041a\u043e\u0434 \u0432\u0438\u0434\u0435\u043d \u0432 \u0430\u0434\u0440\u0435\u0441\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430 \u043f\u0440\u0438 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0437\u0430\u043a\u0443\u043f\u043a\u0438 \u0432 \u041b\u041a \u043d\u0430 \u0415\u0418\u0421. "+ "\u0417\u043d\u0430\u043a (+) \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0441\u043f\u043e\u0441\u043e\u0431 \u0437\u0430\u043a\u0443\u043f\u043a\u0438 \u0432\u043a\u043b\u044e\u0447\u0435\u043d \u0432 \u041f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043e \u0437\u0430\u043a\u0443\u043f\u043a\u0430\u0445, \u0430 (-) - \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u043d\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e \u0435\u0433\u043e \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u0432 \u041f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435. \u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u041f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u043e \u0437\u0430\u043a\u0443\u043f\u043a\u0430\u0445 "+ "\u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u0435\u0436\u0435\u0441\u0443\u0442\u043e\u0447\u043d\u043e\u0439 \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0438. \u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u0431\u0443\u0434\u044c\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u044b \u043f\u0440\u0438 \u0432\u044b\u0431\u043e\u0440\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0437\u0430\u043a\u0443\u043f\u043a\u0438.", autoHide:false,applyTipTo:"label"},plugins:[Ext.ux.plugins.ToolTip],listeners:{beforerender:function(cmp){if(!cmp.hidden)cmp.getStore().load({callback:function(){cmp.setValue(cmp.getValue())}})}}},{xtype:"Application.components.combo",fieldLabel:"\u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044e \u043a \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044e \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430 \u0432 \u0420\u041d\u041f", store:new Ext.data.ArrayStore({fields:["name","code"],data:[["\u041d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e",0],["\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e",1]]}),valueField:"code",displayField:"name",name:"not_dishonest",id:not_dishonest_id,value:this.value?this.value:0,forceSelection:true,mode:"local",editable:false,triggerAction:"all"},{xtype:"Application.components.combo",fieldLabel:"\u0412\u044b\u0431\u043e\u0440 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430 \u0434\u043b\u044f \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430", store:new Ext.data.ArrayStore({fields:["name","code"],data:[["\u041d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d",0],["\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d",1]]}),valueField:"code",displayField:"name",name:"select_participant",value:this.value?this.value:0,forceSelection:true,mode:"local",editable:false,triggerAction:"all",tooltipTpl:"{name}",qtipConfig:{html:"\u041f\u0440\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0435\u0441\u043b\u0438 \u041f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u043e \u0437\u0430\u043a\u0443\u043f\u043a\u0430\u0445 \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u0441 \u043b\u044e\u0431\u044b\u043c \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u043c \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b", autoHide:false,applyTipTo:"label"},plugins:[Ext.ux.plugins.ToolTip],getVisiblity:function(procedure_type){return procedure_type!=PROCEDURE_TYPE_PAPER_SINGLE_SUPPLIER},listeners:{added:function(){this.addEvents("procedurechanged");this.relayEvents(component,["procedurechanged"])},procedurechanged:function(procedure_type){var visible=this.getVisiblity(procedure_type);this.setVisible(visible);this.setDisabled(!visible);if(procedure_type==PROCEDURE_TYPE_PRICELIST){this.setValue(1);this.setDisabled(true)}}}}]}, {xtype:"fieldset",style:"margin: 10px 0 5px 0",value:!!Main.config["preference925_enable"],getValue:function(){return!!this.value},getVisiblity:function(procedure_type){if(!Main.config["preference925_enable"])return false;if(procedure_type==PROCEDURE_TYPE_PAPER_SINGLE_SUPPLIER)return false;return true},setValue:function(v){this.value=!!v;if(!this.value)this.hide()},items:[{xtype:"checkbox",name:"preference925_enabled",hideLabel:true,boxLabel:PREFERENCE925_TEXT}],listeners:{added:function(){this.addEvents("procedurechanged"); this.relayEvents(component,["procedurechanged"])},procedurechanged:function(procedure_type){var visible=this.getVisiblity(procedure_type);this.setVisible(visible);this.setDisabled(!visible||component.with_final_registration)}}},{xtype:"checkbox",name:"hide_organizer",hideLabel:true,boxLabel:"\u0421\u043a\u0440\u044b\u0442\u044c \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e\u0431 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0442\u043e\u0440\u0435",listeners:{check:function(cmp,v){component.organizerInfoCmp.setVisible(!v)}}}, {xtype:"fieldset",title:"\u0421\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e\u0431 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0442\u043e\u0440\u0435",ref:"organizerInfoCmp",items:[{fieldLabel:"\u041d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438",html:Main.contragent.full_name},{fieldLabel:"\u041c\u0435\u0441\u0442\u043e\u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435",html:Main.contragent.legal_address|| "-"},{fieldLabel:"\u041f\u043e\u0447\u0442\u043e\u0432\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0442\u043e\u0440\u0430",html:Main.contragent.postal_address||"-"},{xtype:"Application.components.phonePanel",name:"contact_phone",fieldLabel:"\u041a\u043e\u043d\u0442\u0430\u043a\u0442\u043d\u044b\u0439 \u0442\u0435\u043b\u0435\u0444\u043e\u043d"+REQUIRED_FIELD,value:Main.user.user_phone},{xtype:"textfield",vtype:"email",name:"contact_email",fieldLabel:"\u0410\u0434\u0440\u0435\u0441 \u044d\u043b. \u043f\u043e\u0447\u0442\u044b"+ REQUIRED_FIELD,value:Main.contragent.email},{xtype:"textfield",fieldLabel:"\u041e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u043b\u0438\u0446\u043e"+REQUIRED_FIELD,name:"contact_person",value:Main.user.full_name},{xtype:"textfield",fieldLabel:"\u041c\u0435\u0441\u0442\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044f \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0439"+REQUIRED_FIELD,name:"review_applics_city",hidden:!Main.config.review_applics_city, value:Main.contragent["postal_address"]||""}]},{xtype:"fieldset",id:component.ids.steps_fieldset_id,title:"\u042d\u0442\u0430\u043f\u044b \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b",labelWidth:400,defaults:{labelWidth:400},items:[component.date_published_fld,component.additional_steps_combo_fld,{fieldLabel:"\u041c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u0442\u0430\u043f\u043e\u0432 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b", name:"total_steps",id:total_steps_id,xtype:"Application.components.numberField",hidden:!Main.config.addstep_support},{xtype:"checkbox",hidden:!Main.config.preregistration_support&&!Main.config.multistep_edit_support,fieldLabel:"\u0414\u0432\u0443\u0445\u044d\u0442\u0430\u043f\u043d\u0430\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430",id:twostep_checkbox_id,name:"with_preregistration",listeners:{check:function(cb,checked){var steps=component.steps||Application.models.Procedure.getType(""+ component.procedure_type_id).steps;if(Application.models.Procedure.groups.support_multistep.indexOf(component.procedure_type_id)>=0&&checked)component.with_preregistration=true;else component.with_preregistration=false;component.fireEvent("updateSteps",steps)}}},{fieldLabel:"\u041f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u0435", xtype:"checkbox",name:"price_increase",id:price_increase_id,hidden:true,disabled:true},new Application.components.procedureMultistepGrid({anchor:"100%",frame:false,editable:true,autoScroll:true,autoHeight:true,border:false,loadMask:true,parent:component,addstep:false,editstep:Main.config.multistep_edit_support,baseDate:Ext.getCmp(component.ids.date_published_id)?Ext.getCmp(component.ids.date_published_id).getValue():new Date,listeners:{added:function(){this.addEvents("procedurechanged");this.relayEvents(component, ["procedurechanged"]);this.addEvents("stageschanged");this.relayEvents(component,["stageschanged"]);this.addEvents("oosstate");this.relayEvents(component,["oosstate"])}}})]},{xtype:"fieldset",id:this.ids.changes_fieldset,title:"\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b",hidden:true,items:[{xtype:"Application.components.dateField",fieldLabel:"\u0414\u0430\u0442\u0430 \u043f\u0440\u0438\u043d\u044f\u0442\u0438\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043e\u0431 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438"+ REQUIRED_FIELD,allowBlank:false,format:"d.m.Y",altFormats:"c|d.m.Y H:i:s|d.m.Y H:i",anchor:null,name:"change_decision_date",width:200},{html:"\u041f\u0440\u0438\u0447\u0438\u043d\u0430 \u0432\u043d\u0435\u0441\u0435\u043d\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439:"},{xtype:"textarea",hideLabel:true,allowBlank:false,grow:true,ref:"../modificationDescriptionCmp",name:"modification_description",value:"\u0418\u0437\u043b\u043e\u0436\u0435\u043d\u043e \u0432 \u043f\u0440\u0438\u043b\u0430\u0433\u0430\u0435\u043c\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438"}]}, {xtype:"fieldset",title:"\u0421\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b",id:this.ids.properties_fieldset_id,labelWidth:500,defaults:{labelWidth:400},items:[{fieldLabel:"\u0420\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u043f\u043e\u0434\u0430\u0447\u0443 \u0437\u0430\u044f\u0432\u043e\u043a \u0432\u0441\u0435\u043c \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044f\u043c",xtype:"checkbox",name:"all_applics_allowed",id:applic_checkbox_id, hidden:true},{fieldLabel:"\u041f\u043e\u0440\u044f\u0434\u043e\u043a \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044f \u0437\u0430\u044f\u0432\u043e\u043a",id:component.ids.auction_app_stages_id,xtype:"combo",editable:false,triggerAction:"all",mode:"local",store:[[1,"\u0417\u0430\u044f\u0432\u043a\u0438 \u0432 \u043e\u0434\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438"],[2,"\u0417\u0430\u044f\u0432\u043a\u0438 \u0432 \u0434\u0432\u0443\u0445 \u0447\u0430\u0441\u0442\u044f\u0445"]], value:1,width:249,name:"application_stages",listeners:{select:function(combo){component.changeVisibilityAdditionalStep();component.fireEvent("stageschanged",combo.getValue())}}},{fieldLabel:"\u0414\u043e\u0441\u0442\u0443\u043f \u043a\u043e \u0432\u0442\u043e\u0440\u044b\u043c \u0447\u0430\u0441\u0442\u044f\u043c \u0437\u0430\u044f\u0432\u043e\u043a \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u0432 \u043d\u0430 \u044d\u0442\u0430\u043f\u0435",id:component.ids.second_stage_access_step_id, xtype:"combo",editable:false,triggerAction:"all",mode:"local",width:249,hidden:true,store:[["review","\u041f\u043e\u0434\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0438\u0442\u043e\u0433\u043e\u0432 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b"],["second_stage","\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u0435 \u0437\u0430\u044f\u0432\u043e\u043a \u043d\u0430 \u0443\u0447\u0430\u0441\u0442\u0438\u0435"]],value:"review",name:"second_stage_access_step"},{fieldLabel:"\u0412\u0440\u0435\u043c\u044f \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f \u0446\u0435\u043d\u043e\u0432\u044b\u0445 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0439 (\u043c\u0438\u043d\u0443\u0442)"+ REQUIRED_FIELD,width:80,anchor:false,id:auction_offers_delay_id,xtype:"numberfield",name:"offers_wait_time",allowNegative:false,allowDecimals:false,readOnly:component.frm&&component.frm=="peretorg"?true:false,minValue:component.frm&&component.frm=="peretorg"?60:5,maxValue:1440,value:component.frm&&component.frm=="peretorg"?60:10},{fieldLabel:"\u0428\u0430\u0433 \u0446\u0435\u043d\u043e\u0432\u044b\u0445 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u0432 %"+REQUIRED_FIELD,xtype:"compositefield", msgTarget:"under",cls:"cleanbackground",id:auction_step_id,defaults:{xtype:"Application.components.percentField",allowNegative:false,allowDecimals:true,allowBlank:false,decimalPrecision:4,minValue:1E-4},items:[{xtype:"displayfield",html:"\u043e\u0442 "},{fieldLabel:"\u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0448\u0430\u0433",value:component.frm&&component.frm=="peretorg"?0:.5,maxValue:component.frm&&component.frm=="peretorg"?100:10,readOnly:component.frm&&component.frm== "peretorg"?true:false,width:80,anchor:false,name:"offers_step_min",id:offers_step_min_id},{xtype:"displayfield",html:" \u0434\u043e "},{fieldLabel:"\u041c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0448\u0430\u0433",value:component.frm&&component.frm=="peretorg"?100:1,readOnly:component.frm&&component.frm=="peretorg"?true:false,name:"offers_step_max",id:offers_step_max_id,width:80,anchor:false,maxValue:component.frm&&component.frm=="peretorg"?100:50}]},{xtype:"Application.components.priceField", allowNegative:false,name:"step_reduction",id:step_reduction_id,minValue:.01,maxValue:999999999999,width:100,anchor:false,allowBlank:false,fieldLabel:"\u0428\u0430\u0433 \u043f\u043e\u043d\u0438\u0436\u0435\u043d\u0438\u044f (\u043d\u0435 \u0431\u043e\u043b\u0435\u0435 10 \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u043e\u0432 \u0446\u0435\u043d\u044b \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f)"+ REQUIRED_FIELD,msgTarget:"under",validator:function(v){if(component.start_price_of_lot==0)return"\u0417\u0430\u0434\u0430\u0439\u0442\u0435 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0446\u0435\u043d\u0443 \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f !!!";var num=PriceToNumber(v);if(num===false)return"\u042d\u0442\u043e \u043d\u0435 \u0447\u0438\u0441\u043b\u043e!!!";var m50=num/2;var p10= component.start_price_of_lot/10;if(num>p10)return"\u0428\u0430\u0433 \u043f\u043e\u043d\u0438\u0436\u0435\u043d\u0438\u044f \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0431\u043e\u043b\u0435\u0435 10% \u043e\u0442 "+component.start_price_of_lot+" ( \u0446\u0435\u043d\u044b \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f )";Ext.getCmp(step_auction_id).maxValue=m50; return true}},{xtype:"Application.components.priceField",allowNegative:false,name:"step_auction",id:step_auction_id,minValue:.01,maxValue:999999999999,width:100,anchor:false,allowBlank:false,msgTarget:"under",fieldLabel:"\u0428\u0430\u0433 \u0430\u0443\u043a\u0446\u0438\u043e\u043d\u0430 (\u0441\u0443\u043c\u043c\u0430 \u043d\u0435 \u0431\u043e\u043b\u0435\u0435 50% \u201c\u0428\u0430\u0433\u0430 \u043f\u043e\u043d\u0438\u0436\u0435\u043d\u0438\u044f\u201d)"+REQUIRED_FIELD,validator:function(v){var num= PriceToNumber(v);if(num===false)return"\u042d\u0442\u043e \u043d\u0435 \u0447\u0438\u0441\u043b\u043e!!!";var num2=Ext.getCmp(step_reduction_id).getValue();if(num2<.01)return"\u0417\u0430\u0434\u0430\u0439\u0442\u0435 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0428\u0430\u0433 \u043f\u043e\u043d\u0438\u0436\u0435\u043d\u0438\u044f !!!";var m50=Ext.getCmp(step_reduction_id).getValue()/2;if(num>m50)return"\u0428\u0430\u0433 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0435\u0442 50% \u0441\u0443\u043c\u043c\u044b \u201c\u0428\u0430\u0433\u0430 \u043f\u043e\u043d\u0438\u0436\u0435\u043d\u0438\u044f\u201d"; return true}}]},{xtype:"fieldset",id:component.ids.documents_fieldset_id,title:"\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b",hidden:!Main.config.common_files,items:[{html:"\u0414\u043b\u044f \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0439\u0442\u0435 \u0438\u0445 \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u043e\u0440\u043c\u044b \u043d\u0438\u0436\u0435. "+ "\u041f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0442\u0441\u044f \u0444\u0430\u0439\u043b\u044b \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c \u0434\u043e "+Ext.util.Format.humanizeSize(max_uploadsize)+".
\u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435! \u041f\u0440\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u0439 \u0432 \u0415\u0418\u0421 \u0440\u0430\u0437\u043c\u0435\u0440 \u043e\u0434\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043d\u0435 \u0431\u043e\u043b\u0435\u0435 49 \u041c\u0431, \u0430 \u043e\u0431\u0449\u0438\u0439 \u043e\u0431\u044a\u0435\u043c \u0432\u0441\u0435\u0445 \u043f\u0440\u0438\u043b\u0430\u0433\u0430\u0435\u043c\u044b\u0445 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0442\u044c 500 \u041c\u0431 (\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u0415\u0418\u0421).", cls:"spaced-bottom-shallow"},{id:commonfilepanel_id,xtype:"Application.components.multiuploadPanel",uploadHandler:RPC.Procedure.addFile,deleteHandler:RPC.Procedure.removeFile,name:"common_files",simultaneousUpload:true,autoUpload:true,width:750,listeners:{beforeupload:function(cmp){cmp.uploadParams.procedure_id=component.parent?component.parent.procedure_id||0:0;cmp.uploadParams.type=3},uploadcomplete:function(result,action){if(result.success&&result.procedure_id&&component.parent&&result.procedure_id!= component.parent.procedure_id)component.parent.fireEvent("idchanged",result.procedure_id)}}},{fieldLabel:"\u041f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0437\u0430\u044f\u0432\u043a\u0438 \u0432 \u0431\u0443\u043c\u0430\u0436\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u0435",xtype:"checkbox",name:"paper_form",id:paper_form_reqs_id,hidden:true,disabled:!Main.contragent.special_cab}]},{xtype:"fieldset",title:"\u0414\u043e\u0441\u0442\u0443\u043f \u043a \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435", id:private_fieldset_id,items:[{xtype:"radiogroup",columns:1,hideLabel:true,name:"private",ref:"private",items:[{boxLabel:"\u0414\u043b\u044f \u0432\u0441\u0435\u0445",checked:true,inputValue:"public",name:"procedure_private_checkbox"},{boxLabel:"\u0414\u043b\u044f \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u043a\u0440\u0443\u0433\u0430 \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u0435\u0439",inputValue:"private",name:"procedure_private_checkbox"}],getValues:function(){var v= this.getValue();v=v.inputValue;return v=="private"},setValues:function(v){if(v)this.setValue("private");else this.setValue("public")},listeners:{change:function(group,checked){var cmp=Ext.getCmp(private_access_id);if("private"==checked.inputValue&&!component.with_final_registration)cmp.enable();else cmp.disable()}}},{hideLabel:true,disabled:true,xtype:"Application.components.contragentsSelectForm",title:"\u0423\u043a\u0430\u0436\u0438\u0442\u0435 \u0441\u043f\u0438\u0441\u043e\u043a \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435:", id:private_access_id,name:"private_access",delete_enabled:true,email_unset:true,items:[{layout:"form",labelWidth:250,items:[{anchor:"100%",xtype:"Application.components.procedureFindCombo",hideTrigger:false,pageSize:20,editable:false,triggerAction:"all",id:procedure_find_combo_id,storeBaseParams:{own:1,status:Application.models.Procedure.statuses.archive,procedure_type:Application.models.Procedure.type_ids.qualification},emptyText:"\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441\u043f\u0438\u0441\u043a\u0430 \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u0435\u0439", fieldLabel:"\u0412\u044b\u0431\u0440\u0430\u0442\u044c \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u0435\u0439, \u043f\u0440\u043e\u0448\u0435\u0434\u0448\u0438\u0445 \u043a\u0432\u0430\u043b\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043e\u0442\u0431\u043e\u0440 \u043f\u043e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435",listeners:{select:function(combo,record){RPC.Applic.reviewlist({lot_id:record.data.lots,stage:2},function(resp){if(!resp||!resp.success){echoResponseMessage(resp); return}if(!resp.applications)return;var cmp=Ext.getCmp(private_access_id);if(!cmp)return;var data=[];for(var i=0;i-1;if(item.contragent_id&&!in_names){names.push(parseInt(item.contragent_id));return true}if(!item.contragent_id)return true;return false});cmp.setValues(data)},defaultValue:""}]}]}]},{xtype:"fieldset",style:"margin-top: 3px; margin-bottom: 0px;",items:[{xtype:"checkbox",id:component.ids["skip_fees_checkbox"],name:"skip_fees",hideLabel:true, boxLabel:"\u0411\u0435\u0437 \u0441\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043f\u043b\u0430\u0442\u044b \u0437\u0430 \u0443\u0441\u043b\u0443\u0433\u0438 \u042d\u0422\u041f",hidden:!isCustomerSpecorg()},{xtype:"checkbox",name:"purchase_inside_avtodor",hideLabel:true,boxLabel:"\u0417\u0430\u043a\u0443\u043f\u043a\u0430 \u0432\u043d\u0443\u0442\u0440\u0438 \u0413\u0440\u0443\u043f\u043f\u044b \u041a\u043e\u043c\u043f\u0430\u043d\u0438\u0439 «\u0410\u0432\u0442\u043e\u0434\u043e\u0440»", listeners:{check:function(cmp,checked){if(!!checked)Ext.getCmp(component.ids["skip_fees_checkbox"]).setValue(true)}}},{xtype:"checkbox",name:"sell_contract",hideLabel:true,boxLabel:"\u0414\u043e\u0433\u043e\u0432\u043e\u0440 \u043d\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e"}],getVisiblity:function(procedure_type){return procedure_type==PROCEDURE_TYPE_PAPER_SINGLE_SUPPLIER},listeners:{added:function(){this.addEvents("procedurechanged");this.relayEvents(component,["procedurechanged"])}, procedurechanged:function(procedure_type){var visible=this.getVisiblity(procedure_type);this.setVisible(visible);this.setDisabled(!visible)}}}],listeners:{peretorg:function(frm,stage){this.stage=stage;this.frm=frm;if(stage>0&&frm=="dotorg")Ext.getCmp(applic_checkbox_id).show();else Ext.getCmp(applic_checkbox_id).hide()},peretorg_init:function(){var typesStore=Application.models.Procedure.getPeretorgTypesStore();typesStore.load();Ext.getCmp(procedure_type_id).store=typesStore},purchaseMethodChange:function(newCode, is_electronic){var purchase_method=Ext.getCmp(purchase_method_id);var store=getPurchaseMethodStore();store.load({params:{is_electronic:null},callback:function(r,opts,success){if(success)if(store.findExact("code",newCode)<0)alertError("\u0412 \u0441\u043f\u0440\u0430\u0432\u043e\u0447\u043d\u0438\u043a\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0437\u0430\u043a\u0443\u043f\u043e\u043a \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d \u043a\u043e\u0434 #"+ newCode+" \u0443\u043a\u0430\u0437\u0430\u043d\u044b\u0439 \u0432 \u043f\u043b\u0430\u043d\u0435 \u0437\u0430\u043a\u0443\u043f\u043e\u043a! \u0423\u043a\u0430\u0436\u0438\u0442\u0435 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0432\u0440\u0443\u0447\u043d\u0443\u044e");else{purchase_method.store=store;purchase_method.setValue(newCode)}}})}},getValues:function(){var dt=null,step;var v={organizer_contragent_id:this.organizer_contragent_id};collectComponentValues(this, v,true);v.procedure_type=component.procedure_type_id;if(v.steps.length)for(var c=0;c=0&&v.frm!="peretorg")this.fireEvent("stageschanged",Number(v.application_stages));setComponentValues(this,v,true);component.fireEvent("stageschanged",Ext.getCmp(component.ids.auction_app_stages_id).getValue());if(v.stage>0){if(v.frm=="peretorg"){Ext.getCmp(procedure_type_id).setValue(v.procedure_type);Ext.getCmp(title_id).setReadOnly(true);Ext.getCmp(title_id).addClass("x-readonly");Ext.getCmp(send_oos_checkbox_id).setVisible(false); Ext.getCmp(purchase_method_id).setVisible(false);this.fireEvent("peretorg_init")}this.fireEvent("peretorg",v.stage)}if(Application.models.Procedure.groups.paper_forms.indexOf(v.procedure_type)>=0)component.is_electronic=false;if(null!=v.date_published&&v.version&&v.version>=1){Ext.getCmp(procedure_type_id).disable();Ext.getCmp(twostep_checkbox_id).disable();this.fireEvent("onEditing")}if(v.common_files)Ext.getCmp(commonfilepanel_id).setValues(v.common_files);if(v.peretorg_possible&&Main.config.peretorg_possible_field){var peretorg_possible_field= Ext.getCmp(peretorg_possible_id);if(peretorg_possible_field&&v.peretorg_possible=="\u0435\u0441\u0442\u044c")peretorg_possible_field.setValue(true)}},changeLabelText:function(field_id,label_text){var field=Ext.getCmp(field_id);if(!field)return;if(field.label)field.label.update(label_text+":");else field.fieldLabel=label_text+":"}});this.listeners=this.listeners||{};this.startPriceChanged=function(start_price){component.start_price_of_lot=start_price;if(start_price>0)Ext.getCmp(step_reduction_id).maxValue= start_price};this.changeOosStateCheckboxEvent=function(state){var send_oos_checkbox=Ext.getCmp(send_oos_checkbox_id);send_oos_checkbox.setValue(!!state);send_oos_checkbox.fireEvent("check",send_oos_checkbox)};this.changeProcedureTypeEvent=function(procedure_type){var procedure_type_combo=Ext.getCmp(procedure_type_id);procedure_type_combo.setValue(procedure_type);component.fireEvent("procedurechanged",procedure_type)};this.updateStepsEvent=function(steps){steps=steps||Application.models.Procedure.getType(""+ component.procedure_type_id).steps;var steps_array=Application.models.Procedure.prepareStepsData(steps,undefined,component.procedure_type_id,{with_preregistration:component.with_preregistration,with_prequalification:component.with_prequalification,with_notice_discussion:component.with_notice_discussion,with_first_parts_discussion:component.with_first_parts_discussion,with_final_registration:component.with_final_registration,with_add_price_registration:component.with_add_price_registration,with_contract_decision:component.with_contract_decision}); component.stepGridStore.loadData(steps_array);component.steps=steps_array};this.procedureTypeChanged=function(p,steps){var param_origin_steps=steps;var auc_visible=false;var auc_and_retrade_visible=false;var visible=false;var item,i,record;component.procedure_type_id=p;if(!steps||!steps.length){var type=Application.models.Procedure.type_ids[""+p];steps=Application.models.Procedure.getType(p).steps;for(i=0;i=0);else{component.with_prequalification=false;if(Main.config.preregistration_inprequalification_support)component.with_preregistration=false}component.fireEvent("updateSteps",steps);if(Application.models.Procedure.groups.auctions.indexOf(p)>= 0){auc_visible=true;auc_and_retrade_visible=true}if(Application.models.Procedure.groups.retrades.indexOf(p)>=0)auc_visible=false;var stages=Ext.getCmp(component.ids.auction_app_stages_id);if(!auc_and_retrade_visible&&2==stages.getValue()){stages.setValue(1);stages.fireEvent("select",stages,stages.getValue())}var procedure_properties_disabled=0;var procedure_properties_total=3;for(i=0;i=0){Ext.getCmp(component.ids.second_stage_access_step_id).setVisible(true);Ext.getCmp(component.ids.second_stage_access_step_id).setDisabled(false)}else{Ext.getCmp(component.ids.second_stage_access_step_id).setVisible(false); Ext.getCmp(component.ids.second_stage_access_step_id).setDisabled(true)}if(this.procedure_type_id==PROCEDURE_TYPE_PUBLIC_SALE){procedure_properties_disabled=1;Ext.getCmp(auction_offers_delay_id).hide();Ext.getCmp(auction_step_id).hide();Ext.getCmp(step_auction_id).show();Ext.getCmp(step_reduction_id).show()}else{Ext.getCmp(auction_offers_delay_id).show();Ext.getCmp(auction_step_id).show();Ext.getCmp(step_auction_id).hide();Ext.getCmp(step_reduction_id).hide()}var price_increase_checkbox=Ext.getCmp(price_increase_id); var procedures_with_increase=[Application.models.Procedure.type_ids.price_request,Application.models.Procedure.type_ids.concurrent_procedure];var procedures_with_increase_default_checked=[Application.models.Procedure.type_ids.price_request];if(procedures_with_increase.indexOf(p)>-1){price_increase_checkbox.enable();price_increase_checkbox.show();price_increase_checkbox.setValue(in_array(p,procedures_with_increase_default_checked))}else{price_increase_checkbox.disable();price_increase_checkbox.hide()}if(in_array(p, [Application.models.Procedure.type_ids.contest,Application.models.Procedure.type_ids.purchase_with_grade])){Ext.getCmp(auction_offers_delay_id).hide();Ext.getCmp(auction_step_id).hide();Ext.getCmp(component.ids.auction_app_stages_id).show();Ext.getCmp(component.ids.auction_app_stages_id).setDisabled(false);Ext.getCmp(component.ids.auction_app_stages_id).setReadOnly(component.procedure_data&&component.procedure_data["lots"]&&component.procedure_data["lots"][0]&&component.procedure_data["lots"][0]["status"]&& component.procedure_data["lots"][0]["status"]>1)}if(in_array(p,[PROCEDURE_TYPE_PURCHASE_WITH_GRADE]))Ext.getCmp(component.ids.properties_fieldset_id).setVisible(false);else if(procedure_properties_disabled==procedure_properties_total)Ext.getCmp(component.ids.properties_fieldset_id).setVisible(false);else Ext.getCmp(component.ids.properties_fieldset_id).setVisible(true);var peretorg_possible_field=Ext.getCmp(peretorg_possible_id);if((p==Application.models.Procedure.type_ids.contest||p==Application.models.Procedure.type_ids.quotation|| p==Application.models.Procedure.type_ids.pricelist)&&Main.config.peretorg_possible_field){peretorg_possible_field.setValue(!!Main.config.peretorg_possible_field_value);peretorg_possible_field.setDisabled(false)}else{peretorg_possible_field.setValue(false);peretorg_possible_field.setDisabled(true)}if(Application.models.Procedure.groups.paper_forms.indexOf(p)>=0)var is_electronic=false;else{is_electronic=true;var offers_step_max=Ext.getCmp(offers_step_max_id);var offers_step_min=Ext.getCmp(offers_step_min_id); if(offers_step_max&&offers_step_min){if(p==Application.models.Procedure.type_ids.auction_up){offers_step_min.maxValue=Number.MAX_VALUE;offers_step_min.validate();offers_step_max.maxValue=Number.MAX_VALUE;offers_step_max.validate()}if(p==Application.models.Procedure.type_ids.auction_down){offers_step_min.maxValue=10;offers_step_min.validate();offers_step_max.maxValue=50;offers_step_max.validate()}}}if(!Ext.getCmp(send_oos_checkbox_id).disabled&&is_electronic!=component.is_electronic){component.is_electronic= is_electronic;if(!component.startDefinition)Ext.getCmp(purchase_method_id).setValue("");var purchaseStore=Ext.getCmp(purchase_method_id).getStore();purchaseStore.setBaseParam("is_electronic",is_electronic);purchaseStore.reload()}component.startDefinition=false;if(Application.models.Procedure.groups.retrades.indexOf(p)>=0||component.with_final_registration)Ext.getCmp(private_fieldset_id).disable();else Ext.getCmp(private_fieldset_id).enable();if(Application.models.Procedure.groups.auctions.indexOf(p)>= 0&&p!=Application.models.Procedure.type_ids.peretorg_reduc||in_array(p,[Application.models.Procedure.type_ids.contest,Application.models.Procedure.type_ids.purchase_with_grade]))if(param_origin_steps)component.fireEvent("stageschanged",component.procedure_data.application_stages);else{var stages_combo=Ext.getCmp(component.ids.auction_app_stages_id);if([Application.models.Procedure.type_ids.contest,Application.models.Procedure.type_ids.auction_down,Application.models.Procedure.type_ids.purchase_with_grade].indexOf(p)> -1)stages_combo.setValue(2);component.fireEvent("stageschanged",stages_combo.getValue())}if(!Main.config.multistep_edit_support&&Application.models.Procedure.groups.support_multistep.indexOf(component.procedure_type_id)>=0){if(Main.config.preregistration_support||Main.config.multistep_edit_support)Ext.getCmp(twostep_checkbox_id).show();if(Main.config.addstep_support){Ext.getCmp(total_steps_id).enable();Ext.getCmp(total_steps_id).show()}}else{Ext.getCmp(twostep_checkbox_id).hide();Ext.getCmp(total_steps_id).disable(); Ext.getCmp(total_steps_id).hide()}if(Main.config.paper_form){var paper_form=Ext.getCmp(paper_form_reqs_id);if(Application.models.Procedure.groups.paper_forms.indexOf(component.procedure_type_id)>=0)paper_form.setValue(1);else paper_form.setValue(0)}var skip_before_contract_checkbox=Ext.getCmp(skip_before_contract_checkbox_id);if(skip_before_contract_checkbox)skip_before_contract_checkbox.setVisible(p==Application.models.Procedure.type_ids.paper_single_supplier);Ext.getCmp(component.ids["additional_steps_combo_id"]).setVisible(!component.frm|| component.frm!="peretorg");if(in_array(this.procedure_type_id,component.price_request_similar_procedure))Ext.getCmp(component.ids["additional_steps_combo_id"]).setVisible(false);if(p===Application.models.Procedure.type_ids.purchase_with_grade)Ext.getCmp(component.ids["additional_steps_combo_id"]).setValue(["STEP_ADD_PRICE_REGISTRATION"]);if([PROCEDURE_TYPE_PAPER_SINGLE_SUPPLIER,PROCEDURE_PRICE_REQUEST,PROCEDURE_TYPE_QUALIFICATION,PROCEDURE_CONCURRENT_PROCEDURE,PROCEDURE_TYPE_PURCHASE_WITH_GRADE,PROCEDURE_TYPE_PRICELIST].indexOf(this.procedure_type_id)> -1)Ext.getCmp(send_oos_checkbox_id).setValue(false);if([PROCEDURE_TYPE_PRICELIST].indexOf(this.procedure_type_id)>-1){Ext.getCmp(choose_contragent_id).setVisible(true);Ext.getCmp(procedure_find_combo_id).setVisible(false);Ext.getCmp(private_access_id).setAddButtonVisibile(false);Ext.getCmp(private_fieldset_id).private.setValues(true)}else{Ext.getCmp(choose_contragent_id).setVisible(false);Ext.getCmp(procedure_find_combo_id).setVisible(true);Ext.getCmp(private_access_id).setAddButtonVisibile(true); Ext.getCmp(private_fieldset_id).private.setValues(false)}this.doLayout()};Ext.apply(this.listeners,{procedurechanged:this.procedureTypeChanged,startpricechanged:this.startPriceChanged,updateSteps:this.updateStepsEvent,changeOosStateCheckbox:this.changeOosStateCheckboxEvent,changeProcedureType:this.changeProcedureTypeEvent,scope:this});this.organizer_contragent_id=Main.contragent.id;Application.components.procedureBasicFormMultiStep.superclass.initComponent.call(this);autoSetValue(this);this.fireEvent("procedurechanged", Main.config.basic_proc_type)},changeVisibilityAdditionalStep:function(){var auction_app_stages=Ext.getCmp(this.ids.auction_app_stages_id);if(auction_app_stages.getValue()===1&&[PROCEDURE_PRICE_REQUEST,PROCEDURE_TYPE_AUC_ASC,PROCEDURE_TYPE_AUC_DESC,PROCEDURE_CONCURRENT_PROCEDURE,PROCEDURE_TYPE_PAPER_SINGLE_SUPPLIER].indexOf(this.procedure_type_id)>-1)Ext.getCmp(this.ids["additional_steps_combo_id"]).setVisible(false);else Ext.getCmp(this.ids["additional_steps_combo_id"]).setVisible(true);if(auction_app_stages.getValue()=== 2){if(Application.models.Procedure.groups.second_stage_acccess_managed.indexOf(this.procedure_type_id)>=0){Ext.getCmp(this.ids.second_stage_access_step_id).setVisible(true);Ext.getCmp(this.ids.second_stage_access_step_id).setDisabled(false)}}else{Ext.getCmp(this.ids.second_stage_access_step_id).setVisible(false);Ext.getCmp(this.ids.second_stage_access_step_id).setDisabled(true)}var addStepsStore=Ext.getCmp(this.ids["additional_steps_combo_id"]).getStore();var addPriceIndex=addStepsStore.find("id", "STEP_ADD_PRICE_REGISTRATION");if(addPriceIndex>=0){addStepsStore.getAt(addPriceIndex).set("disabled",Application.models.Procedure.groups.requests.indexOf(this.procedure_type_id)>=0);Ext.getCmp(this.ids["additional_steps_combo_id"]).reconfigure()}}});Ext.define("Application.components.procedureCancelForm",{extend:"Ext.form.Panel",frame:false,border:false,initComponent:function(){var component=this;component.lot_panel_id=Ext.id();var notify_text_id=Ext.id(),deadline_cmp=Ext.id(),deadline_ends_cmp=Ext.id(),filepanel_id=Ext.id();this.addEvents("dataload");Ext.apply(this,{labelWidth:150,frame:true,autoScroll:true,title:"\u0418\u0437\u0432\u0435\u0449\u0435\u043d\u0438\u0435 \u043e\u0431 \u043e\u0442\u043a\u0430\u0437\u0435 \u043e\u0442 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f "+ (component.lot_id?"\u043b\u043e\u0442\u0430":"\u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b")+" \u0432 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u0435",fileUpload:true,items:[{id:deadline_ends_cmp,border:false,hidden:true,bodyStyle:"font-size: 12px"},{id:deadline_cmp,border:false,hidden:true,bodyStyle:"font-size: 12px"},{xtype:"Application.components.procedureViewPanel",id:component.lot_panel_id,procedure_id:component.procedure_id,procedureAutoLoad:true, autoHeight:true,frame:false,border:false,style:"padding-bottom: 5px",listeners:{"dataload":function(procedure){component.procedure=procedure;var filePanel=Ext.create({id:filepanel_id,xtype:"Application.components.multiuploadPanel",uploadHandler:RPC.Procedure.addFile,deleteHandler:RPC.Procedure.removeFile,name:"file",simultaneousUpload:true,autoUpload:true,requiredDescr:false,requiredMark:component.procedure.procedure_type!=PROCEDURE_TYPE_PAPER_SINGLE_SUPPLIER,listeners:{beforeupload:function(cmp){cmp.uploadParams.procedure_id= component.procedure_id;if(component.lot_id)cmp.uploadParams.lot_id=component.lot_id;else cmp.uploadParams.lot_id=null;cmp.uploadParams.type=2}}});component.filesFieldset.add(filePanel);component.filesFieldset.doLayout();if(component.procedure.cancel_files)filePanel.setValues(component.procedure.cancel_files);if(component.lot_id){var lots=procedure.lots;for(var l in lots)if(lots[l].id==component.lot_id){component.setTitle("\u0418\u0437\u0432\u0435\u0449\u0435\u043d\u0438\u0435 \u043e\u0431 \u043e\u0442\u043a\u0430\u0437\u0435 \u043e\u0442 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043b\u043e\u0442\u0430 \u2116"+ lots[l].number+" \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u2116"+procedure.registry_number+" \u0432 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u0435");component.lot_number=lots[l].number;break}}var date_may_canceled=parseDate(component.procedure.date_may_canceled),now=new Date;if(date_may_canceled){Ext.getCmp(deadline_ends_cmp).update('
\u041a\u0440\u0430\u0439\u043d\u0438\u0439 \u0441\u0440\u043e\u043a \u043e\u0442\u043a\u0430\u0437\u0430 \u043e\u0442 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u0438\u0441\u0442\u0451\u043a '+ date_may_canceled.format("d.m.Y")+"
");Ext.getCmp(deadline_ends_cmp).setVisible(now>date_may_canceled);Ext.getCmp(deadline_cmp).update('
\u041a\u0440\u0430\u0439\u043d\u0438\u0439 \u0441\u0440\u043e\u043a \u043e\u0442\u043a\u0430\u0437\u0430 \u043e\u0442 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b '+date_may_canceled.format("d.m.Y")+".
");Ext.getCmp(deadline_cmp).setVisible(now<= date_may_canceled)}}}},{xtype:"fieldset",title:"\u0421\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e\u0431 \u043e\u0442\u043a\u0430\u0437\u0435 \u043e\u0442 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f "+(component.lot_id?"\u043b\u043e\u0442\u0430":"\u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b")+" \u0432 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u0435",style:"margin: 5px;",items:[{xtype:"hidden",name:"procedure_id",value:component.procedure_id}, {xtype:"hidden",name:"lot_id",value:component.lot_id},{xtype:"textarea",name:"cancel_text",id:notify_text_id,anchor:"100%",fieldLabel:"\u041e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u043b\u044f \u043e\u0442\u043a\u0430\u0437\u0430",height:70},{xtype:"checkbox",name:"is_cancel_emergency",boxLabel:"\u0417\u0430\u043a\u0443\u043f\u043a\u0430 \u043e\u0442\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0432\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u043e\u0431\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u0441\u0442\u0432 \u043d\u0435\u043f\u0440\u0435\u043e\u0434\u043e\u043b\u0438\u043c\u043e\u0439 \u0441\u0438\u043b\u044b \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u0433\u0440\u0430\u0436\u0434\u0430\u043d\u0441\u043a\u0438\u043c \u0437\u0430\u043a\u043e\u043d\u043e\u0434\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u043e\u043c"}, {xtype:"fieldset",ref:"../filesFieldset",title:"\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b \u043e\u0431 \u043e\u0442\u043a\u0430\u0437\u0435 \u043e\u0442 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f "+(component.lot_id?"\u043b\u043e\u0442\u0430":"\u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b"),items:[{html:"\u0414\u043b\u044f \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0439\u0442\u0435 \u0438\u0445 \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u043e\u0440\u043c\u044b \u043d\u0438\u0436\u0435. "+ ACCEPTED_FILES+".",cls:"spaced-bottom-shallow"}]}]}],buttons:[{text:"\u041f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c \u0438 \u043d\u0430\u043f\u0440\u0430\u0432\u0438\u0442\u044c",scope:this,formBind:true,handler:function(){var tpl;var filepanel=Ext.getCmp(filepanel_id);var files_info=filepanel.getFilesInfo();var parameters=this.getValues();if(component.lot_id)tpl=getLotCancelTemplate();else tpl=getProcedureCancelTemplate();var data={registry_number:component.procedure.registry_number,date_cancelled:Ext.util.Format.localDateRenderer(new Date).replace(" ", " "),user_fio:Main.user.full_name,cancel_basis:parameters.cancel_text,is_cancel_emergency:parameters.is_cancel_emergency};if(component.lot_id)Ext.apply(data,{lot_number:component.lot_number});var signatureText=tpl.applyTemplate(data);var winItems=[];for(var paramName in parameters)if(parameters.hasOwnProperty(paramName))winItems.push({xtype:"hidden",name:paramName,value:parameters[paramName]});var win=new Application.components.promptWindow({title:"\u041e\u0442\u043a\u0430\u0437 \u043e\u0442 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u0432 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u0435", cmpType:"Application.components.SignatureForm",parentCmp:this,cmpParams:{api:RPC.Procedure.cancel,signatureText:signatureText,signatureTextHeight:250,useFormHandler:false,success_fn:function(resp){win.close();echoResponseMessage(resp);redirect_to("com/procedure/index")},items:winItems}});win.show()}},BACKWARD_BUTTON],getValues:function(){var values={};collectComponentValues(this,values,false);return values}});Application.components.procedureCancelForm.superclass.initComponent.call(this)}});Ext.define("Application.components.procedureCustomersForm",{extend:"Ext.form.Panel",autoHeight:true,status:null,count_customers:0,max_customers:0,is_oss:false,initComponent:function(){this.addEvents("addcustomer","oosstate");this.add_customer_btn_id=Ext.id();Ext.apply(this,{anchor:"100%",allowBlank:false,border:false,bodyCssClass:"subpanel-top-padding",items:[this.createCustomer()],buttons:[{text:"\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u0430", id:this.add_customer_btn_id,scope:this,handler:function(){var customers=new Ext.data.DirectStore({autoLoad:true,directFn:RPC.Company.representedRightsList,root:"rows",sortInfo:{field:"id",direction:"ASC"},idProperty:"id",paramsAsHash:true,fields:["id","date","valid_for","contragent_representative_id","full_name","status","address",{name:"disabled",convert:function(v,r){return this.isCustomerExists(r.id)}.createDelegate(this)}],listeners:{scope:this,load:function(){var self=new customers.recordType({id:Main.contragent.id|| 0,full_name:Main.contragent.full_name||"-",address:Main.contragent.legal_address||"-",disabled:this.isCustomerExists(Main.contragent.id)});self.phantom=false;customers.insert(0,self)}}});var selector_id=Ext.id();var customer_selector=new Ext.Window({title:"\u0412\u044b\u0431\u043e\u0440 \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u0430",modal:true,width:600,autoHeight:true,layout:"fit",items:[{layout:"anchor",frame:true,autoHeight:true,items:[{html:"\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u0430 \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430:"}, {xtype:"Application.components.combo",id:selector_id,disabledField:"disabled",displayField:"full_name",valueField:"id",store:customers,allowBlank:false,editable:false,anchor:"0",triggerAction:"all",mode:"local"}]}],buttons:[{text:"\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u0430",scope:this,handler:function(){var selector=Ext.getCmp(selector_id);if(selector.isValid()){customer_selector.close();var r=customers.find("id",selector.getValue());var rdata= customers.getAt(r);if(rdata&&rdata.data)this.add(this.createCustomer(rdata.data));this.doLayout()}}},{text:"\u041e\u0442\u043c\u0435\u043d\u0430",handler:function(){customer_selector.close()}}]});customer_selector.show()}}]});Application.components.procedureCustomersForm.superclass.initComponent.call(this);autoSetValue(this);this.on("afterlayout",function(){var btn=Ext.getCmp(this.add_customer_btn_id);if(this.max_customers!==0&&this.count_customers>=this.max_customers)btn.disable();else btn.enable()}, this);this.on("oosstate",function(state){this.is_oss=state},this)},setValue:function(v){this.count_customers=0;var to_del=[];var i;this.items.each(function(c){if("fieldset"==c.xtype)to_del.push(c)});for(i=0;icmp.lotNumber)l.setLotNumber(l.lotNumber-1)});tp.remove(cmp);tp.doLayout()},idchanged:function(id){component.procedure_id=id},peretorg:function(frm,stage){component.stage=stage}});if(this.editable)this.buttons=[{text:"\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0438\u0437 \u0448\u0430\u0431\u043b\u043e\u043d\u0430",hidden:this.frm?true:false,id:button_load_from_template_id, handler:function(){var win=new Application.components.templateGrid({mode:"load",procedure_id:component.procedure_id,listeners:{templateloaded:function(template){component.setValues(template);component.loadedProcedure=null;win.close()}}});win.show()}},{text:"\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043a\u0430\u043a \u0448\u0430\u0431\u043b\u043e\u043d",hidden:this.frm?true:false,handler:function(){var win=new Application.components.templateGrid({mode:"save",procedure_template:component.getValues()}); win.show()}},{text:"\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c",handler:function(){var redirect_to_edit=false;if(!component.procedure_id)redirect_to_edit=true;component.performSave(function(){if(redirect_to_edit)redirect_to("com/procedure/edit/id/"+component.procedure_id)})},scope:this},{text:"\u041f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c \u0438 \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u0442\u044c",handler:function(){var cnt=0,warn=[],warn_fatal=false;var procedure_params= {};var grid=component.findBy(function(cmp){return cmp instanceof Application.components.procedureMultistepGrid})||[];if(grid.length){var errors=grid[0].validateStepDates();if(errors.length){var error_text="

\u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u0438\u0441\u043f\u0440\u0430\u0432\u044c\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 c\u043e \u0441\u0440\u043e\u043a\u0430\u043c\u0438 \u044d\u0442\u0430\u043f\u043e\u0432 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b:

"; error_text+='
    ';Ext.each(errors,function(error){if(error.err_type==="user")error_text+="
  1. "+error.message+"
  2. "});error_text+="
";alertError(error_text);return}var errorsLimitDate=grid[0].validateLimitDate();if("warnError"in errorsLimitDate)warn.push(errorsLimitDate.warnError)}var mainTab=Ext.getCmp(this.formId);var mainTab_validate=isFormValidAdvanced(mainTab);if(mainTab_validate!==true){alertFormErrors(mainTab_validate);return}collectComponentValues(Ext.getCmp(this.formId), procedure_params);if(procedure_params.offers_step_max&&procedure_params.offers_step_min&&procedure_params.offers_step_min>procedure_params.offers_step_max){alertError("\u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0448\u0430\u0433 \u0446\u0435\u043d\u043e\u0432\u044b\u0445 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e."); return}if(component.loadedProcedure&&!!procedure_params["send_to_oos"]&&procedure_params["change_decision_date"]==""){alertError("\u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u0434\u0430\u0442\u0443 \u043f\u0440\u0438\u043d\u044f\u0442\u0438\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043e\u0431 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438\n");return}var no_errors=this.eachLot(function(l){cnt++;var valid=l.validate(procedure_params); if(true!==valid&&!valid.success){var error_text="

\u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u0438\u0441\u043f\u0440\u0430\u0432\u044c\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0432\u043e \u0432\u043a\u043b\u0430\u0434\u043a\u0430\u0445 \u043b\u043e\u0442\u0430 \u2116"+cnt+":

";error_text+='
    ';Ext.each(valid.msg,function(error){error_text+="
  1. "+error+"
  2. "});error_text+="
"; alertError(error_text);return false}});if(!no_errors)return false;if(0==cnt){alertError("\u0423 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u043b\u043e\u0442\u044b. \u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u043e\u0434\u0438\u043d \u043b\u043e\u0442.");return}var doRedirect=function(){var redirect_to_edit= false;if(!component.procedure_id)redirect_to_edit=true;if(redirect_to_edit){Main.procedure_edit_link_redirect="com/procedure/sign/procedure/"+component.procedure_id;redirect_to("com/procedure/edit/id/"+component.procedure_id)}else if(component.procedure_id)redirect_to("com/procedure/sign/procedure/"+component.procedure_id);else alertError("\u041f\u043e\u0447\u0435\u043c\u0443-\u0442\u043e \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0435\u0449\u0435 \u0440\u0430\u0437.")}; var data=component.getValues();if(data.send_to_oos&&Ext.isEmpty(data.purchase_method_code)){warn_fatal=true;warn.push('\u041e\u0448\u0438\u0431\u043a\u0430: \u0441\u043f\u043e\u0441\u043e\u0431 \u0437\u0430\u043a\u0443\u043f\u043a\u0438 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u0435\u043d \u0434\u043b\u044f \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0430 \u0438\u0437\u0432\u0435\u0449\u0435\u043d\u0438\u044f \u043e \u0437\u0430\u043a\u0443\u043f\u043a\u0435 \u043d\u0430 zakupki.gov.ru')}function doSave(){function save(){if(Main.config.disable_remote_edit&& data.id&&data.remote_id)doRedirect();else component.performSave(doRedirect,true)}if(Main.contragent.oos_send&&!data.send_to_oos&&!in_array(data.procedure_type,[PROCEDURE_TYPE_PAPER_SINGLE_SUPPLIER,PROCEDURE_TYPE_PURCHASE_WITH_GRADE,PROCEDURE_TYPE_PRICELIST])&&(!component.frm||component.frm!="peretorg"))Ext.Msg.confirm("\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435",'\u0412\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435 \u0445\u043e\u0442\u0438\u0442\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0415\u0434\u0438\u043d\u0443\u044e \u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u0443\u044e \u0421\u0438\u0441\u0442\u0435\u043c\u0443 (zakupki.gov.ru)? \u041f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u0430 \u043d\u0430 \u041e\u0431\u0449\u0435\u0440\u043e\u0441\u0441\u0438\u0439\u0441\u043a\u043e\u043c \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u0430\u0439\u0442\u0435', function(b){if("yes"==b)save()});else if(data.procedure_type==PROCEDURE_TYPE_PAPER_SINGLE_SUPPLIER&&isEmpty(data.purchase_method_code)&&isContragentOosUser())Ext.Msg.confirm("\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435",'\u041f\u043e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435 \u043d\u0435 \u0432\u044b\u0431\u0440\u0430\u043d\u0430 \u043f\u043e\u0437\u0438\u0446\u0438\u044f \u043f\u043b\u0430\u043d\u0430 \u0437\u0430\u043a\u0443\u043f\u043a\u0438. \u0414\u043b\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u0439 \u043e \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u0432 \u0415\u0434\u0438\u043d\u0443\u044e \u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u0443\u044e \u0421\u0438\u0441\u0442\u0435\u043c\u0443 (zakupki.gov.ru) \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u043f\u043b\u0430\u043d\u0430 \u0437\u0430\u043a\u0443\u043f\u043a\u0438. \u0412\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f \u043a \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b?', function(b){if("yes"==b)return false;else save()});else save()}if(this.loadedProcedure&&this.loadedProcedure.organizer_user_id&&Main&&Main.user&&this.loadedProcedure.version&&Main.user.id!=this.loadedProcedure.organizer_user_id)warn.push("\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435: \u0432\u044b \u043f\u044b\u0442\u0430\u0435\u0442\u0435\u0441\u044c \u0432\u043d\u0435\u0441\u0442\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0432 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443, \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0434\u0440\u0443\u0433\u0438\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c"); if(warn.length){warn=warn.join("
  • ");if(warn_fatal){alertError('
    1. '+warn+"
    2. ");return}else Ext.Msg.confirm("\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435",warn+"
      \n\u0412\u044b \u0443\u0432\u0435\u0440\u0435\u043d\u044b \u0447\u0442\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443?",function(b){if("yes"== b)doSave()})}else doSave()},scope:this}];Ext.apply(this,{activeTab:0,enableTabScroll:true,defaults:{frame:true}});Application.components.procedureEditForm.superclass.initComponent.call(this);if(this.value)autoSetValue(this);else this.on("beforerender",function(){this.addLot();if(this.frm&&this.frm=="peretorg")this.fireEvent("peretorg_init")},this,{once:true});if(this.procedure_id)this.on("afterrender",function(){var params={mask:true,mask_el:this.getEl(),scope:this};var p={procedure_id:this.procedure_id, stage:this.frm,lot_id:this.lot_id};performRPCCall(RPC.Procedure.loaddraft,[p],params,function(resp){if(resp&&resp.success){if(resp.procedure.version){var button_load_from_template=Ext.getCmp(button_load_from_template_id);button_load_from_template.setVisible(false)}this.procedure_organizer_department_id=resp.procedure.organizer_department_id;if(component.frm=="peretorg")resp.procedure.date_published=new Date;if(resp.procedure["change_decision_date"])delete resp.procedure["change_decision_date"];this.setValues(resp.procedure); this.stageParam=resp.procedure.stage;this.loadedProcedure=resp.procedure;var form_cmp=Ext.getCmp(this.formId);if(form_cmp&&!isEmpty(resp.procedure.lots))form_cmp.setDatePublishedEditable(!resp.procedure.lots[0]["status"]||resp.procedure.lots[0]["status"]<2)}else if(resp)echoResponseMessage(resp)})},this,{once:true})},eachLot:function(callback){if(!Ext.isFunction(callback))return false;var result=true;this.items.each(function(item){if(item.lotNumber)if(false===callback(item)){result=false;return false}return true}); return result},getLotsCount:function(){return this.items.getCount()-2},getLotSubTabByName:function(lot_no,tab_name){var result=false;this.items.each(function(item){if(item.lotNumber==lot_no){var sub_tab=Ext.getCmp(item.ids[tab_name]);if(!isEmpty(sub_tab))result=sub_tab}return true});return result},performSave:function(callback,cancel_load_values){var component=this;var form_values=this.getValues();var call_params=null;if(Main.config.procedure_coordination)if((!form_values.old_coordination_status|| form_values.old_coordination_status==COORDINATION_STATUS_DECLINED)&&form_values.coordination_status==COORDINATION_STATUS_COORDINATION)call_params={confirm:"\u0412\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0435\u0441\u044c \u043d\u0430\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u0443\u044e \u0437\u0430\u043a\u0443\u043f\u043a\u0443 \u043d\u0430 \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u0438\u0435. \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c?"}; else if(form_values.old_coordination_status==COORDINATION_STATUS_COORDINATION&&form_values.coordination_status==COORDINATION_STATUS_RESOLVED)call_params={confirm:"\u0412\u044b \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043b\u0438 \u0434\u0430\u043d\u043d\u0443\u044e \u0437\u0430\u043a\u0443\u043f\u043e\u0447\u043d\u0443\u044e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443. \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c?"};else if(form_values.old_coordination_status== COORDINATION_STATUS_COORDINATION&&form_values.coordination_status==COORDINATION_STATUS_DECLINED)call_params={confirm:"\u041e\u0442\u043a\u0430\u0437 \u0432 \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u0438\u0438 \u0437\u0430\u043a\u0443\u043f\u043e\u0447\u043d\u043e\u0439 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b. \u0412\u0435\u0440\u043d\u0443\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 \u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044e. \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c?"}; performRPCCall(RPC.Procedure.save,[form_values],call_params,function(result){if(result.success){component.procedure_id=result.procedure.id;if(result.procedure&&!cancel_load_values)component.setValues(result.procedure);else if(result.procedure_id)this.fireEvent("idchanged",result.procedure_id);if(Ext.isFunction(callback))callback(result)}else echoResponseMessage(result)})},addLot:function(autoswitch,value,price_increase){var newlot=new Application.components.procedureLotForm({parent:this,closable:this.editable&& !(this.frm&&this.frm=="peretorg"),value:value});var lotnumbers=[];this.eachLot(function(l){lotnumbers.push(Number(l.getLotNumber()))});var lotnum=1;while(lotnumbers.indexOf(lotnum)>=0)lotnum++;if(value){if(this.frm=="peretorg")if(price_increase)RPC.Applic.getMaxPrice(value.basic_lot_id,function(resp){if(resp.success)newlot.setPrice(resp.price)});else RPC.Applic.getMinPrice(value.basic_lot_id,function(resp){if(resp.success)newlot.setPrice(resp.price)});newlot.setLotNumber(value.number);if(value.basic_lot_id)newlot.basic_lot_id= value.basic_lot_id;else newlot.lot_id=value.id}else newlot.setLotNumber(lotnum);newlot.relayEvents(this,["procedurechanged","oosstate","stageschanged","peretorg","lotpricechanged"]);var basicForm=Ext.getCmp(this.formId);var comboProcedureType=basicForm.getForm().findField("procedure_type").getValue();newlot.fireEvent("procedurechanged",comboProcedureType);newlot.relayEvents(basicForm,["onEditing"]);newlot.relayEvents(basicForm,["addcustomer"]);var insPos=this.items.getCount();if(this.editable&&!this.frm)insPos--; this.insert(insPos,newlot);if(this.rendered)this.doLayout();if(autoswitch)this.setActiveTab.defer(100,this,[insPos]);return this},getValues:function(){var first_tab=Ext.getCmp(this.formId);var values=first_tab.getValues();if(this.procedure_id)values.id=this.procedure_id;var dates={date_published:values.date_published,date_end_registration:values.date_end_registration,date_end_first_parts_review:values.date_end_first_parts_review,date_end_second_parts_review:values.date_end_second_parts_review,date_applic_opened:values.date_applic_opened, date_begin_auction:values.date_begin_auction,time_begin_auction:values.time_begin_auction};values.lots=[];this.eachLot(function(l){l=l.getValues();Ext.apply(l,dates);values.lots.push(l)});if(Ext.isEmpty(values.purchase_method_code)&&values.lots.length&&Ext.isDefined(values.lots[0].lot_customers))if(values.lots[0].lot_customers.length&&!Ext.isEmpty(values.lots[0].lot_customers[0].purchase_method_code))values.purchase_method_code=values.lots[0].lot_customers[0].purchase_method_code;if(first_tab.with_final_registration=== true){var initalValues=this.initalValues;initalValues.steps=values.steps;values=initalValues}return values},setValues:function(v){this.initalValues=v;var to_del=[],to_hide=[];var i;this.procedure_id=v.id;this.stage=v.stage;var cmp=this;if(null!=v.date_published&&v.version&&v.version>=1){this.editable=false;this.items.each(function(item){if(item.lotAdd){cmp.remove(item);return false}return true})}if(v.lots){this.eachLot(function(l){if(!l.lot_id)to_del.push(l)});this.eachLot(function(l){if(!l.lot_id)to_del.push(l)}); for(i=0;i0)for(var i=0;i0){experts_names=experts_names.join(", ");confirm_text="\u0412\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0435\u0441\u044c \u043f\u0440\u0438\u0432\u043b\u0435\u0447\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u044d\u043a\u0441\u043f\u0435\u0440\u0442\u043d\u044b\u0435 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438: "+ experts_names+". \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c?"}else confirm_text="\u0412\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0435\u0441\u044c \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u0443\u0441\u0442\u044b\u043c \u043f\u0435\u0440\u0435\u0447\u0435\u043d\u044c \u044d\u043a\u0441\u043f\u0435\u0440\u0442\u043d\u044b\u0445 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0439. \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c?"; performRPCCall(RPC.Procedure.expertssave,[parameters],{confirm:confirm_text,wait_text:"\u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u043f\u0435\u0440\u0435\u0447\u043d\u044c \u044d\u043a\u0441\u043f\u0435\u0440\u0442\u043e\u0432"},function(result){if(result.success)Ext.Msg.alert("\u0423\u0441\u043f\u0435\u0448\u043d\u043e","\u041f\u0435\u0440\u0435\u0447\u0435\u043d\u044c \u044d\u043a\u0441\u043f\u0435\u0440\u0442\u043d\u044b\u0445 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0439 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d", function(){redirect_to("com/procedure/index")});else echoResponseMessage(result)})}},{text:"\u0417\u0430\u043a\u0440\u044b\u0442\u044c",handler:function(){redirect_to("com/procedure/index")}}],getValues:function(){var values={};collectComponentValues(this,values,false);return values},emptyTextShow:function(){var experts_list=component.getExpertsList();var empty_text=Ext.getCmp(empty_text_id);if(experts_list.items.length==1)empty_text.setVisible(true);else empty_text.setVisible(false)},getExpertsList:function(){if(!this.experts_list)this.experts_list= Ext.getCmp(experts_list_id);return this.experts_list},addExpert:function(id,untouchable){if(component.experts_added[id]){Ext.Msg.alert("\u041e\u0448\u0438\u0431\u043a\u0430","\u041e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u0443\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430");return}var combo_expert=Ext.getCmp(combo_expert_id);var combo_expert_store=combo_expert.getStore();var rec=combo_expert_store.getById(id);if(!rec)return;var experts_list=component.getExpertsList(); experts_list.add({xtype:"checkbox",hideFieldLabel:true,boxLabel:rec.data.company,value:id,readOnly:true===untouchable?true:false,disabled:true===untouchable?true:false});component.experts_added[rec.data.id]=rec;combo_expert.clearValue();component.emptyTextShow();component.doLayout()}});Application.components.procedureExpertsForm.superclass.initComponent.call(this)}});Ext.define("Application.components.procedureInviteEmailsForm",{extend:"Ext.form.Panel",frame:false,border:false,initComponent:function(){var component=this;var empty_text_id=Ext.id(),emails_list_id=Ext.id(),field_email_id=Ext.id();this.emails_added={};this.addEvents("dataload");Ext.apply(this,{labelWidth:150,frame:true,autoScroll:true,title:"\u0424\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u0447\u043d\u044f e-mail \u0430\u0434\u0440\u0435\u0441\u043e\u0432 \u0434\u043b\u044f \u0440\u0430\u0441\u0441\u044b\u043b\u043a\u0438 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0439", fileUpload:true,items:[{xtype:"Application.components.procedureViewPanel",procedure_id:component.procedure_id,procedureAutoLoad:true,autoHeight:true,frame:false,border:false,style:"padding-bottom: 5px",listeners:{"dataload":function(procedure){if(procedure.invite_emails){var invite_emails=procedure.invite_emails.split(";");for(var i=0;i=grid.getStore().getCount())return}var grid_store=grid.getStore();grid_store.remove(record);grid_store.insert(index,record);grid.getSelectionModel().selectRow(index,true);grid_store.fireEvent("datachanged",grid_store)};var updateOrderNumbers=function(){var cnt=1;component.getStore().data.each(function(rec){rec.data.order_number=cnt;cnt++})};var combo=new Ext.form.ComboBox({triggerAction:"all",store:this.step_store,valueField:"pseudo", editable:true,forceSelection:true,displayField:"pseudo",lazyRender:false,mode:"local",listClass:"x-combo-list-small"});var dateRenderer=function(v){if(null===v)return v;if(v==="")return'\u0414\u0414.\u041c\u041c.\u0413\u0413\u0413\u0413';else{var dt=parseDate(v);return dt.format("d.m.Y")}};var timeRenderer=function(v){if(null===v)return v;if(v==="")return'\u0427\u0427:\u041c\u041c';else return v};var orderConductRenderer=function(v,meta, record){if(!in_array(record.data.step_id,Application.models.Procedure.order_conduct_steps_required))return null;if(!v&&record.data.step_id!="edit"&&record.data.step_id!="contract")return"\u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0435\u0439";else return v};var orderLocationRenderer=function(v,meta,record){if(!in_array(record.data.step_id,Application.models.Procedure.order_location_steps_required))return null; if(!v&&record.data.step_id!="edit"&&record.data.step_id!="contract")return'(\u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e)';else return v};var stepRenderer=function(pseudo){var store=component.step_store;var idx=store.findExact("pseudo",pseudo);if(idx>-1){var item=store.getAt(idx);return item.get("name")}return""};var columns=[{header:"\u0418\u0414",dataIndex:"id",editor:Ext.ux.helpers.numberEdit(),sortable:false,hidden:true},{header:"\u041d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u044d\u0442\u0430\u043f\u0430", dataIndex:"step_id",width:140,sortable:false,gridId:component.id,renderer:stepRenderer},{header:"\u0414\u0430\u0442\u0430 \u043d\u0430\u0447\u0430\u043b\u0430
      \u044d\u0442\u0430\u043f\u0430",dataIndex:"date_start",width:85,editor:Ext.ux.helpers.dateEdit(),renderer:dateRenderer,sortable:false},{header:"\u0412\u0440\u0435\u043c\u044f \u043d\u0430\u0447\u0430\u043b\u0430",dataIndex:"time_start",width:70,editor:Ext.ux.helpers.timeEdit(),renderer:timeRenderer,sortable:false},{header:"\u0414\u0430\u0442\u0430 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f
      \u044d\u0442\u0430\u043f\u0430", dataIndex:"date_end",width:85,editor:Ext.ux.helpers.dateEdit(),renderer:dateRenderer,sortable:false},{header:"\u0412\u0440\u0435\u043c\u044f
      \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f",dataIndex:"time_end",width:70,editor:Ext.ux.helpers.timeEdit(),renderer:timeRenderer,sortable:false},{header:"\u041f\u043e\u0440\u044f\u0434\u043e\u043a \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f",hidden:true,dataIndex:"order_conduct",width:160,editor:Ext.ux.helpers.textEdit(),renderer:orderConductRenderer}, {header:"\u041c\u0435\u0441\u0442\u043e \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f",hidden:true,dataIndex:"order_location",width:160,editor:Ext.ux.helpers.textEdit(),renderer:orderLocationRenderer},{header:"\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u0438",xtype:"textactioncolumn",actionsSeparator:" ",sortable:false,hidden:!Main.config.multistep_edit_support,items:[{icon:"/ico/arrow_up.png",tooltip:"\u0412\u044b\u0448\u0435",isHidden:function(v,m,r){updateOrderNumbers();if(component.block_steps_till&& r.data.order_number<=component.block_steps_till+1)return true;if(r.data.order_number==1)return true;return false},handler:function(grid,rowIndex){moveSelectedRow(grid,rowIndex,-1)}},{icon:"/ico/arrow_down.png",tooltip:"\u041d\u0438\u0436\u0435",isHidden:function(v,m,r){updateOrderNumbers();if(component.block_steps_till&&r.data.order_number<=component.block_steps_till)return true;if(r.data.order_number==component.getStore().data.length)return true;return false},handler:function(grid,rowIndex){moveSelectedRow(grid, rowIndex,+1)}},{icon:"/ico/delete.png",tooltip:"\u0423\u0434\u0430\u043b\u0438\u0442\u044c",isHidden:function(v,m,r){updateOrderNumbers();if(component.block_steps_till&&r.data.order_number<=component.block_steps_till)return true;return false},handler:function(grid,rowIndex){grid.getStore().removeAt(rowIndex)}}]}];Ext.apply(this,{store:component.parent.stepGridStore,columns:columns,clicksToEdit:1,viewConfig:{forceFit:true,getRowClass:function(record,rowIndex,rp,ds){if(record.get("disabled")===true)return"semi_transparent"}}, sm:new Ext.grid.RowSelectionModel({singleSelect:true}),tbar:[{iconCls:"icon-silk-add",hidden:!component.editstep,text:"\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0442\u0430\u0434\u0438\u044e",handler:function(){var record=new component.parent.stepGridStore.recordType({id:null,date_end:"",time_end:"",date_start:null,time_start:null});component.parent.stepGridStore.add(record);component.startEditing(component.parent.stepGridStore.getCount()-1,1)}},{xtype:"tbspacer",width:50,hidden:!Main.config.multistep_edit_support}, {iconCls:"icon-silk-add",hidden:!component.addstep,text:"\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u044d\u0442\u0430\u043f",handler:function(){var record_correction=new component.parent.stepGridStore.recordType({id:null,step_id:"correction",date_start:null,date_end:"",time_start:null,time_end:""});var record_envelopes=new component.parent.stepGridStore.recordType({id:null,step_id:"applic_opened",date_start:null,date_end:"",time_start:null,time_end:""});var record_selection=new component.parent.stepGridStore.recordType({id:null, step_id:"first_parts",date_start:null,date_end:"",time_start:null,time_end:null});component.parent.stepGridStore.insert(component.parent.stepGridStore.getCount()-1,record_correction);if(Application.models.Procedure.hasStage("applic_opened",component.step_store,component.procedure_type_id))component.parent.stepGridStore.insert(component.parent.stepGridStore.getCount()-1,record_envelopes);if(Application.models.Procedure.hasStage("first_parts",component.step_store,component.procedure_type_id))component.parent.stepGridStore.insert(component.parent.stepGridStore.getCount()- 1,record_selection);component.startEditing(component.parent.stepGridStore.getCount()-3,0)}}],bbar:[{cls:"x-btn-text-icon",icon:"ico/undo.png",text:"\u041e\u0442\u043c\u0435\u043d\u0438\u0442\u044c",handler:function(){component.parent.stepGridStore.rejectChanges()}}],listeners:{added:function(){this.step_store.load();if(!component.holidays)performRPCCall(RPC.Reference.holidays,[],{wait_disable:true},function(resp){component.holidays=resp.holidays;component.workdays=resp.workdays})},procedurechanged:function(v){this.step_store.setBaseParam("procedure_type_id", v);this.step_store.reload({callback:function(){component.parent.stepGridStore.fireEvent("datachanged",component.parent.stepGridStore)}})},oosstate:function(v){var cm=this.getColumnModel();var col_index=cm.findColumnIndex("order_conduct");var col2_index=cm.findColumnIndex("order_location");if(col_index)cm.setHidden(col_index,!v)},stageschanged:function(stages){var stageschangedAtContest=function(stages){var found_at=-1;component.parent.stepGridStore.each(function(r){if(r.data.step_id=="applic_opened")found_at= component.parent.stepGridStore.indexOfId(r.id)});if(stages==2&&found_at>-1)component.parent.stepGridStore.removeAt(found_at);else if(stages!=2&&found_at<0){var position=null,steps=Application.models.Procedure.prepareStepsData(Application.models.Procedure.getType(component.parent.procedure_type_id).steps,undefined,component.parent.procedure_type_id,{with_preregistration:component.parent.with_preregistration,with_prequalification:component.parent.with_prequalification,with_notice_discussion:component.parent.with_notice_discussion, with_first_parts_discussion:component.parent.with_first_parts_discussion,with_add_price_registration:component.parent.with_add_price_registration}),applic_opened_step=new component.parent.stepGridStore.recordType({id:null,step_id:"applic_opened",date_start:null,time_start:null,date_end:"",time_end:""});Ext.iterate(steps,function(step,index){if("applic_opened"===step.step_id){position=index;return false}});if(null===position)component.parent.stepGridStore.add(applic_opened_step);else component.parent.stepGridStore.insert(position, applic_opened_step)}};var stageschangedAtAuctions=function(stages){var found_at=-1;component.parent.stepGridStore.each(function(r){if(r.data.step_id=="second_parts"&&!isContest)found_at=component.parent.stepGridStore.indexOfId(r.id)});if(stages==1){if(found_at!=-1)component.parent.stepGridStore.removeAt(found_at)}else if(found_at==-1){var position=null,record_second_parts=new component.parent.stepGridStore.recordType({id:null,step_id:"second_parts",date_start:null,date_end:"",time_start:null,time_end:null}), steps=Application.models.Procedure.prepareStepsData(Application.models.Procedure.getType(component.parent.procedure_type_id).steps,undefined,component.parent.procedure_type_id);Ext.iterate(steps,function(step,index){if("second_parts"===step.step_id){position=index;return false}});if(null===position)component.parent.stepGridStore.add(record_second_parts);else component.parent.stepGridStore.insert(position,record_second_parts)}};var isContest=component.parent.procedure_type_id===Application.models.Procedure.type_ids.contest; if(!component.parent.procedure_type_id)return;if(Application.models.Procedure.groups.auctions.indexOf(component.parent.procedure_type_id)>-1)return stageschangedAtAuctions(stages);if(isContest)return stageschangedAtContest(stages)},stepSelected:function(v){var store=this.getStore();var step_record=store.getAt(store.find("step_id",v));if(step_record)component.block_steps_till=step_record.data.order_number},beforeedit:function(e){if(e.field=="step_id"&&!component.editstep)return false;if(e.record&& e.record.get("disabled")===true)return false;if(!this.isEditGrid(e))return false;if(e.field!="date_start"&&e.field!="date_end"&&e.field!="time_end"&&e.field!="time_start")return;var grid=e.grid;var record=e.record;var fieldname=e.field;var fieldvalue=e.value;var rowIndex=e.row;var colIndex=e.column;var cancel=e.cancel;if(!record.data.step_id)return;if(fieldvalue==null||record.data.order_number-1&&in_array(e.field,["time_start","date_start"])){var date_obj=component.processDate(e.record.data.date_start,e.record.data.time_start,e.field);if(isEmpty(date_obj))return; date_obj.setHours(date_obj.getHours()+3);e.record.data.date_end=date_obj;e.record.data.time_end=(date_obj.getHours()>9?date_obj.getHours():"0"+date_obj.getHours())+":"+(date_obj.getMinutes()>9?date_obj.getMinutes():"0"+date_obj.getMinutes());e.grid.view.refresh();return}if(e.field!="step_id")return;if(!e.value||Ext.isEmpty(e.value))return;var step_data=Application.models.Procedure.getStep(e.value);e.record.data.date_start=null;e.record.data.time_start=null;e.record.data.date_end=null;e.record.data.time_end= null;if(step_data.pseudo.indexOf("date_start")>=0){e.record.data.date_start="";e.record.data.time_start=""}else if(step_data.pseudo!=""){e.record.data.date_end="";e.record.data.time_end=""}e.grid.view.refresh()}},getValues:function(){this.saveStepData();return component.steps},saveStepData:function(){component.steps=[];component.step_names=[];var counter=1;component.parent.stepGridStore.data.each(function(rec){if(component.procedure_id)rec.data.procedure_id=component.procedure_id;if(rec.data.step_id== "trade"&&component.step_names.indexOf("trade")>=0){Ext.Msg.alert("\u041e\u0448\u0438\u0431\u043a\u0430","\u042d\u0442\u0430\u043f \u041f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b (\u0442\u043e\u0440\u0433\u0438) \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0442\u044c\u0441\u044f \u0434\u0432\u0430\u0436\u0434\u044b. \u041f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0435 \u0442\u043e\u0440\u0433\u0438 \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430 \u043f\u0435\u0440\u0435\u0442\u043e\u0440\u0436\u043a\u0438 \u0432 \u043e\u0447\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u0435"); return}rec.data.order_number=counter;var date_obj,field_data=Application.models.Procedure.getStep(rec.data.step_id);if(!Ext.isEmpty(rec.data.date_start)){date_obj=component.processDate(rec.data.date_start,rec.data.time_start,field_data);rec.data.date_start=date_obj.format("c")}if(!Ext.isEmpty(rec.data.date_end)){date_obj=component.processDate(rec.data.date_end,rec.data.time_end,field_data);rec.data.date_end=date_obj.format("c")}component.step_names.push(rec.data.step_id);component.steps.push(rec.data); counter+=1})},processDate:function(dt,tm,field_data){var time="",date_obj;date_obj=parseDate(dt);if(tm&&!Ext.isEmpty(tm)){time=tm.split(":");date_obj.setHours(time[0]);date_obj.setMinutes(time[1]);date_obj.setSeconds(0);date_obj.setMilliseconds(0)}else{date_obj.setHours(0);date_obj.setMinutes(0);date_obj.setSeconds(0);date_obj.setMilliseconds(0)}if(field_data.addTime&&!tm){if(field_data.addTime.hour)date_obj=date_obj.add(Date.HOUR,field_data.addTime.hour);if(field_data.addTime.minute)date_obj=date_obj.add(Date.MINUTE, field_data.addTime.minute)}return date_obj}});Application.components.procedureMultistepGrid.superclass.initComponent.call(this)},getHolidaysByLimitDays:function(limitDays){var component=this,holidays=0;if(Number(limitDays)===limitDays&&limitDays%1===0){var start=new Date;for(var i=1;inew Date(step.date_end))errors.push({message:'\u0412\u0440\u0435\u043c\u044f \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u044d\u0442\u0430\u043f\u0430 "'+step_descr.status_name.defaultName+ '" \u0440\u0430\u043d\u044c\u0448\u0435 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u044d\u0442\u0430\u043f\u0430 '+prev_step_descr.status_name.defaultName,err_type:"user"});if(!isEmpty(prev_step.date_end)&&!isEmpty(step.date_start)&&!isEmpty(prev_step.time_end)&&new Date(prev_step.date_end)>new Date(step.date_start))errors.push({message:'\u0412\u0440\u0435\u043c\u044f \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u044d\u0442\u0430\u043f\u0430 "'+step_descr.status_name.defaultName+ '" \u0440\u0430\u043d\u044c\u0448\u0435 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u044d\u0442\u0430\u043f\u0430 '+prev_step_descr.status_name.defaultName,err_type:"user"})}prev_step=step});return errors},isEditGrid:function(e){switch(e.field){case "order_conduct":return in_array(e.record.data.step_id,Application.models.Procedure.order_conduct_steps_required);case "order_location":return in_array(e.record.data.step_id,Application.models.Procedure.order_location_steps_required)}return true}, setDisabledDates:function(cmp){var component=this;var iterator=0;var start=new Date;var disabled_dates=[];while(true){var tmpDate=start.add(Date.DAY,iterator);if(component.holidays&&component.holidays.indexOf(tmpDate.format("d.m.Y"))!=-1||component.workdays&&tmpDate.getDay()%6==0&&component.workdays.indexOf(tmpDate.format("d.m.Y"))==-1)disabled_dates.push(tmpDate.format("d.m.Y"));++iterator;if(iterator>100)break}cmp.setDisabledDates(disabled_dates);return},isValid:function(){var values=this.getValues(); var valid=true;Ext.iterate(values,function(val){if(val["date_end"]===""||val["date_start"]==="")valid=false});return valid},setProcedureDateDisabling:function(cmp,baseDate,fld,procedureDateSettings){cmp.makeDateDisabling(baseDate,fld,procedureDateSettings)}});Ext.define("Application.components.procedureOperatorDocumentAddForm",{extend:"Ext.form.Panel",frame:false,border:false,initComponent:function(){var component=this;component.lot_panel_id=Ext.id();var notify_text_id=Ext.id(),filepanel_id=Ext.id();this.addEvents("dataload");Ext.apply(this,{labelWidth:150,frame:true,autoScroll:true,title:"\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 \u0432 \u0438\u0437\u0432\u0435\u0449\u0435\u043d\u0438\u0435", fileUpload:true,items:[{xtype:"Application.components.procedureViewPanel",id:component.lot_panel_id,procedure_id:component.procedure_id,procedureAutoLoad:true,procedureLoadDraft:true,title:"\u0421\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435",autoHeight:true,frame:true,border:false,style:"padding-bottom: 5px",listeners:{"dataload":function(procedure){component.procedure=procedure;if(component.procedure.operator_files&&component.procedure.operator_files[component.lot_id])Ext.getCmp(filepanel_id).setValues(component.procedure.operator_files[component.lot_id]); if(component.lot_id){var lots=procedure.lots;for(var l in lots)if(lots[l].id==component.lot_id){component.setTitle("\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 \u0432 \u0438\u0437\u0432\u0435\u0449\u0435\u043d\u0438\u0435 \u043b\u043e\u0442\u0430 \u2116"+lots[l].number+" \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u2116"+procedure.registry_number+" \u0432 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u0435"); component.lot_number=lots[l].number;var notify_text=Ext.getCmp(notify_text_id);notify_text.setValue("\u041d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b "+procedure.registry_number+" \u043b\u043e\u0442\u0430 \u2116"+lots[l].number+" \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u00ab\u0418\u0437\u0432\u0435\u0449\u0435\u043d\u0438\u0435\u00bb \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d(\u044b) \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442(\u044b)"); break}}}}},{xtype:"fieldset",title:"\u0421\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e \u043f\u0440\u0438\u043a\u0440\u0435\u043f\u043b\u044f\u0435\u043c\u044b\u0445 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0445",style:"margin: 5px;",items:[{xtype:"hidden",name:"procedure_id",value:component.procedure_id},{xtype:"hidden",name:"lot_id",value:component.lot_id},{xtype:"textarea",name:"notify_text",id:notify_text_id,anchor:"100%",fieldLabel:"\u0422\u0435\u043a\u0441\u0442 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f", height:70},{xtype:"fieldset",title:"\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438",items:[{html:"\u0414\u043b\u044f \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0439\u0442\u0435 \u0438\u0445 \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u043e\u0440\u043c\u044b \u043d\u0438\u0436\u0435. "+ ACCEPTED_FILES+".",cls:"spaced-bottom-shallow"},{id:filepanel_id,xtype:"Application.components.multiuploadPanel",uploadHandler:RPC.Procedure.addFile,deleteHandler:RPC.Procedure.removeFile,name:"file",simultaneousUpload:true,autoUpload:true,requiredDescr:false,requiredMark:true,listeners:{beforeupload:function(cmp){cmp.uploadParams.procedure_id=component.procedure_id;cmp.uploadParams.lot_id=component.lot_id;cmp.uploadParams.type=4}}}]}]}],buttons:[{text:"\u041f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c \u0438 \u043d\u0430\u043f\u0440\u0430\u0432\u0438\u0442\u044c", scope:this,formBind:true,handler:function(){var tpl;var filepanel=Ext.getCmp(filepanel_id);var files_info=filepanel.getFilesInfo();if(this.isValid()!==true||files_info.length==0){Ext.Msg.alert("\u041e\u0448\u0438\u0431\u043a\u0430","\u0417\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u044b \u043d\u0435 \u0432\u0441\u0435 \u043f\u043e\u043b\u044f");return}var files_text="";for(var cnt=0;cnt1)history.back();else redirect_to("com/procedure/index")}, items:winItems}});win.show()}}],getValues:function(){var values={};collectComponentValues(this,values,false);return values},setValues:function(v){if(!v)return;setComponentValues(this,v,true);return this},listeners:{beforerender:function(){Ext.getCmp(component.lot_panel_id).relayEvents(component,["lotloaded"]);var steps,type;Ext.getBody().mask("\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435");RPC.Lot.load(component.lot_id,function(resp){if(resp.success){component.procedure= resp.procedure;component.lot=resp.procedure.lot;component.procedure_type=resp.procedure.procedure_type;component.procedure_type_id=resp.procedure.procedure_type;var typesStore=Application.models.Procedure.getTypesStoreFromRPC();typesStore.load({callback:function(){var record=typesStore.getById(component.procedure_type);component.procedureDateSettings=record.data;component.fireEvent("lotloaded",resp.procedure);Ext.getBody().unmask();if(component.lot.steps&&component.lot.steps.length)steps=component.lot.steps; else{type=Application.models.Procedure.type_ids[""+component.procedure_type];steps=Application.models.Procedure.getType(component.procedure_type).steps}component.lot_steps=steps;component.statusStore=Application.models.Procedure.createLotStepsStore(steps);component.stepGridStore.loadData(Application.models.Procedure.prepareStepsData(steps,component.lot.status,component.procedure_type,{allow_all:true},true));component.fireEvent("stageschanged",component.procedure.application_stages);Ext.getCmp("newstatus").store= component.statusStore;Ext.getCmp("newstatus").setValue(component.lot.lot_step);Ext.getCmp("newstatus").fireEvent("valueFilled",component.lot.lot_step);component.setValues(component.lot)}});if(component.procedure_type==Application.models.Procedure.type_ids.quotation&&Ext.getCmp(date_end_first_parts_review_id))Ext.getCmp(date_end_first_parts_review_id).setDisabled(true)}else{Ext.Msg.alert("\u041e\u0448\u0438\u0431\u043a\u0430",resp.message);Ext.getBody().unmask()}})},lotloaded:function(){setComponentValues(this, component.lot,true)},stepSelected:function(step){if(Application.models.Procedure.system_steps.indexOf(step)>=0)return;Ext.getCmp(this.ids.multistep_grid_id).enable()}}});Application.components.procedureRestoreForm.superclass.initComponent.call(this)}});Ext.define("Application.components.stepAssignForm",{extend:"Ext.form.FieldSet",autoHeight:true,parent:null,initComponent:function(){var component=this;component.ids=this.parent.ids;var time_begin_auction_id=Ext.id(),step_infopanel_id=Ext.id(),step_jsoninfo_id=Ext.id(),step_panel_id=Ext.id();var all_dates_fields=[this.ids.date_end_registration_id,this.ids.date_applic_opened_id,this.ids.date_end_first_parts_review_id,this.ids.date_begin_auction_id,this.ids.time_begin_auction_id,this.ids.date_end_second_parts_review_id, this.ids.date_itog_id,this.ids.date_end_correction_id,this.ids.date_start_peretorg_reduc,this.ids.date_end_prequalification_id,this.ids.date_end_postqualification_id,this.ids.date_start_peretorg_contest];component.procedure_id=component.parent.parent.procedure_id||null;component.multistep=false;component.steps=[];component.dateFields=[];component.date_published_fld=new Application.components.dateField({fieldLabel:"\u0414\u0430\u0442\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b"+ REQUIRED_FIELD,xtype:"Application.components.dateField",id:this.ids.date_published_id,format:"d.m.Y",altFormats:"c|d.m.Y H:i:s|d.m.Y H:i",anchor:null,name:"date_published",width:200,value:now(),minValue:new Date,listeners:{beforerender:function(){this.addEvents("typeComboLoaded","ParentDateSelected")},select:function(){this.fireEvent("ParentDateSelected",this.getValue())},valueFilled:function(v){this.fireEvent("ParentDateSelected",v)},typeComboLoaded:function(){this.fireEvent("ParentDateSelected", this.getValue())}}});component.time_begin_auction_field={xtype:"timefield",fieldLabel:"\u0412\u0440\u0435\u043c\u044f \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f"+REQUIRED_FIELD+":",labelSeparator:"",id:time_begin_auction_id,format:"H:i",altFormats:"c|d.m.Y H:i:s|d.m.Y H:i",anchor:null,name:"time_begin_auction",width:200};this.holidays=null;this.workdays=null;this.addEvents("procedurechanged");this.addEvents("stepschanged");this.addEvents("stageschanged");this.addEvents("peretorg"); this.addEvents("peretorg_init");this.addEvents("onEditing");var notifier=function(event){return function(){if(this.isValid()){var cur_value=this.getValue();this.fireEvent(event,cur_value)}}};Ext.apply(this,{labelWidth:300,title:"\u042d\u0442\u0430\u043f\u044b \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b",defaults:{anchor:"100%",defaults:{border:false,anchor:"100%",labelWidth:300,allowBlank:false}},bodyCssClass:"subpanel",items:[component.date_published_fld, new Ext.Panel({frame:false,border:false,name:"steps",id:component.ids.properties_fieldset_id,layout:"form",labelWidth:400,items:[]})],listeners:{peretorg:function(frm,stage){},peretorg_init:function(){}},getValues:function(){var dt=null;var v={};collectComponentValues(this,v,true);v.procedure_type=component.parent.procedure_type_id;if(v.time_begin_auction&&v.date_begin_auction){var time=v.time_begin_auction.split(":");v.date_begin_auction.setHours(time[0]);v.date_begin_auction.setMinutes(time[1]); v.date_begin_auction.setSeconds(0);v.date_begin_auction.setMilliseconds(0);v.time_begin_auction=true}else v.time_begin_auction=false;if(v.date_end_second_parts_review)v.date_end_second_parts_review=v.date_end_second_parts_review.add(Date.MINUTE,23*60+59);if(!Main.config.applic_opened_visible)if(v.procedure_type==Application.models.Procedure.type_ids.contest||v.procedure_type==Application.models.Procedure.type_ids.quotation){dt=Ext.getCmp(this.ids.date_end_registration_id).getValue();v.date_applic_opened= component.calculateDateOpened(dt)}return v},calculateDateOpened:function(dt){if(typeof dt=="string")dt=parseDate(dt);dt.setHours(0);dt.setMinutes(0);dt.setSeconds(1);dt.setMilliseconds(0);dt=dt.add(Date.DAY,1);dt=dt.add(Date.MINUTE,23*60+59);return dt},setValues:function(v){if(v.date_begin_auction&&v.time_begin_auction){v.date_begin_auction=parseDate(v.date_begin_auction);v.time_begin_auction=v.date_begin_auction.format("H:i");v.date_begin_auction.setHours(0);v.date_begin_auction.setMinutes(0);v.date_begin_auction.setSeconds(0); v.date_begin_auction.setMilliseconds(0)}if(!v.time_begin_auction)v.time_begin_auction=null;if(v.date_published){var date_now=new Date;var saved_date=parseDate(v.date_published);Ext.getCmp(this.ids.date_published_id).setMinValue(date_now=0){var iterator=0;var start=new Date;var disabled_dates=[];while(true){var tmpDate=start.add(Date.DAY,iterator);if(component.holidays&&component.holidays.indexOf(tmpDate.format("d.m.Y"))!=-1||component.workdays&&tmpDate.getDay()%6==0&&component.workdays.indexOf(tmpDate.format("d.m.Y"))==-1)disabled_dates.push(tmpDate.format("d.m.Y"));++iterator;if(iterator>100)break}cmp.setDisabledDates(disabled_dates)}return}, constructDateField:function(order_number,field_data,previous_field_event){var fieldLabel=field_data.full_name.defaultName;var proc_type_pseudo=component.procedure_type_id;if(field_data.full_name[proc_type_pseudo])fieldLabel=field_data.full_name[proc_type_pseudo];var dateField=new Application.components.dateField({fieldLabel:fieldLabel+REQUIRED_FIELD,id:component.ids[field_data.pseudo+"_id_step_"+order_number],format:"d.m.Y",altFormats:"c|d.m.Y H:i:s|d.m.Y H:i",anchor:null,name:field_data.pseudo,width:200, listeners:{beforerender:function(){this.addEvents("ParentDateSelected",field_data["pseudo"]+"_selected_step_"+order_number)},select:function(){var cur_value=this.getValue();var date=(new Date(this.getValue())).add(Date.HOUR,field_data.addTime.hour);this.setValue(date.format(field_data.format))},change:notifier(field_data["pseudo"]+"_selected_step_"+order_number),valueFilled:function(v){this.fireEvent(field_data["pseudo"]+"_selected_step_"+order_number,v)}}});dateField.on(previous_field_event,function(v){if(!v|| v=="")return;this.makeDateDisabling(v,field_data.fld,component.procedureDateSettings)});return dateField},changeLabelText:function(field_id,label_text){var field=Ext.getCmp(field_id);if(!field)return;if(field.label)field.label.update(label_text+":");else field.fieldLabel=label_text+":"},createStepList:function(steps){var step_list="",i,stIdx,st;if(!steps||!steps.length)return step_list;for(i=0;i0){previous_datefield_data=ordered[i-1]["field_data"];previous_field_event=previous_datefield_data["pseudo"]+"_selected_step_"+(i+"")}else previous_field_event="ParentDateSelected";dF=component.constructDateField(ordered[i]["order_number"], ordered[i]["field_data"],previous_field_event);if(i>0)dF.relayEvents(Ext.getCmp(component.ids[previous_datefield_data["pseudo"]+"_id_step_"+(i+"")]),[previous_field_event]);else dF.relayEvents(component.date_published_fld,["ParentDateSelected"]);parentCmp.add(dF);if(Application.models.Procedure.groups.auctions.indexOf(component.procedure_type_id)>=0&&ordered[i]["field_data"]["pseudo"]=="date_begin_auction"){parentCmp.add(component.time_begin_auction_field);component.changeLabelText(time_begin_auction_id, component.time_begin_auction_text);component.setDisabledDates(dF)}}parentCmp.doLayout();setComponentValues(parentCmp,dateValues,true);component.steps=steps;var steps_json=Ext.util.JSON.encode(steps);Ext.getCmp(step_jsoninfo_id).setValue(steps_json);Ext.getCmp(step_jsoninfo_id).fireEvent("valueFilled",steps_json);component.multistep=true};Ext.apply(this.listeners,{procedurechanged:function(v){this.procedure_type_id=v},scope:this});Ext.apply(this.listeners,{stepschanged:this.stepsChanged,scope:this}); this.relayEvents(this.parent,["stepschanged","procedurechanged"]);Application.components.procedureStepAssignForm.superclass.initComponent.call(this)}});Ext.define("Application.components.procedureSubjectForm",{extend:"Ext.form.Panel",autoHeight:true,parent:null,procedureType:null,initComponent:function(){var component=this;this.products_list_id=Ext.id();this.add_positional_id=Ext.id();this.subject_id=Ext.id();var price_cut_off_id=Ext.id();this.start_price_id=Ext.id();this.price_formula=Ext.id();this.commodity_price=Ext.id();this.max_contract_price=Ext.id();this.nds_percent_combo=Ext.id();this.compare_application_without_vat_checkbox=Ext.id();var nomenclature_id= Ext.id();var okved_id=Ext.id();var single_unit_id=Ext.id();var no_price_ids=[this.start_price_id];this.loaded_okved=[];this.loaded_okpd=[];addEvents(this,["procedurechanged","stageschanged","productremove","startpricechanged","onEditing","lotpricechanged","openpurchaseplandialog"]);component.addEvents("updateOkved2List");component.addEvents("updateOkpd2List");Ext.apply(this,{labelWidth:300,defaults:{anchor:"100%",xtype:"fieldset",defaults:{border:false,anchor:"100%",labelWidth:300,allowBlank:false}}, bodyCssClass:"subpanel-top-padding",items:[{style:"padding-top: 6px;",items:[{xtype:"Application.components.PlanPositionSelectPanel",contragentId:Main.user.contragent_id,ref:"../planPositionSelectPanelCmp",name:"purchase_plan_item",hidden:!isContragentOosUser(),listeners:{onselect:function(plan_item){if(!isEmpty(plan_item))Ext.Msg.show({title:"\u0410\u0432\u0442\u043e\u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435",msg:'\u0417\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u043f\u043b\u0430\u043d\u0430 \u0437\u0430\u043a\u0443\u043f\u043e\u043a \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043f\u043e\u043b\u0435\u0439:
      1. \u0421\u043f\u043e\u0441\u043e\u0431 \u0437\u0430\u043a\u0443\u043f\u043a\u0438 \u043f\u043e \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0443 \u0415\u0418\u0421
      2. \u041f\u0440\u0435\u0434\u043c\u0435\u0442 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430
      3. \u041d\u0430\u0447\u0430\u043b\u044c\u043d\u0430\u044f \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0446\u0435\u043d\u0430
      4. \u041a\u043e\u0434\u044b \u041e\u041a\u041f\u04142
      5. \u041a\u043e\u0434\u044b \u041e\u041a\u0412\u042d\u04142
      6. \u041c\u0435\u0441\u0442\u043e \u043f\u043e\u0441\u0442\u0430\u0432\u043a\u0438 \u0442\u043e\u0432\u0430\u0440\u0430 / \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442 / \u043e\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0443\u0441\u043b\u0443\u0433
      7. \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a
      ', buttons:Ext.Msg.YESNO,fn:function(result){if(result=="yes"){var nomenclature=[];component.loaded_okved=[];component.loaded_okpd=[];if(plan_item["plan_purchase_item_rows"]&&plan_item["plan_purchase_item_rows"][0]&&plan_item["plan_purchase_item_rows"][0]["okpd2"])nomenclature=[{name:plan_item["plan_purchase_item_rows"]["0"]["okpd2"]["name"],code:plan_item["plan_purchase_item_rows"]["0"]["okpd2"]["code"],full_name:plan_item["plan_purchase_item_rows"]["0"]["okpd2"]["code"]+" "+plan_item["plan_purchase_item_rows"]["0"]["okpd2"]["name"]}]; var lot_units=[];Ext.iterate(plan_item["plan_purchase_item_rows"],function(plan_purchase_item_row){lot_units.push({quantity:plan_purchase_item_row["qty"]||null,type_object_purchase:plan_purchase_item_row["type_object_purchase"]||null,okei_code:!isEmpty(plan_purchase_item_row["okei"])?plan_purchase_item_row["okei"]["code"]:null,okpd2_code:!isEmpty(plan_purchase_item_row["okpd2"])?plan_purchase_item_row["okpd2"]["code"]:null,okved2_code:!isEmpty(plan_purchase_item_row["okved2"])?plan_purchase_item_row["okved2"]["code"]: null});component.loaded_okpd.push({name:plan_purchase_item_row["okpd2"]["name"],code:plan_purchase_item_row["okpd2"]["code"],full_name:plan_purchase_item_row["okpd2"]["code"]+" "+plan_purchase_item_row["okpd2"]["name"]});component.loaded_okved.push({name:plan_purchase_item_row["okved2"]["name"],code:plan_purchase_item_row["okved2"]["code"],full_name:plan_purchase_item_row["okved2"]["code"]+" "+plan_purchase_item_row["okved2"]["name"]})});var okved2=[];if(plan_item["plan_purchase_item_rows"]&&plan_item["plan_purchase_item_rows"][0]&& plan_item["plan_purchase_item_rows"][0]["okved2"])okved2=[{name:plan_item["plan_purchase_item_rows"]["0"]["okved2"]["name"],code:plan_item["plan_purchase_item_rows"]["0"]["okved2"]["code"],full_name:plan_item["plan_purchase_item_rows"]["0"]["okved2"]["code"]+" "+plan_item["plan_purchase_item_rows"]["0"]["okved2"]["name"]}];setComponentValues(component,{start_price:plan_item["maximum_contract_price"],max_contract_price:plan_item["maximum_contract_price"],subject:plan_item["contract_subject"],nomenclature:nomenclature, okved2:okved2});if(!isEmpty(plan_item["region"]))component.parent.getDeliveryForm().setValues([{quantity:"",term:"",address:plan_item["region"]}]);if(!isEmpty(plan_item["plan_item_customer"])){var customersTab=component.parent.getCustomers();if(!customersTab.isCustomerExists(plan_item["plan_item_customer"]["id"])){customersTab.clear();customersTab.addCustomer({id:plan_item["plan_item_customer"]["id"],full_name:plan_item["plan_item_customer"]["full_name"],address:plan_item["plan_item_customer"]["legal_address"]})}}if(!isEmpty(lot_units))Ext.getCmp(component.products_list_id).setValues(lot_units); component.fireEvent("startpricechanged",parsePrice(plan_item["maximum_contract_price"]));if(component["parent"]&&component["parent"]["parent"]&&component["parent"]["parent"]["xtype"]=="Application.components.procedureEditForm"){var root_cmp=component["parent"]["parent"];if(root_cmp){var basic_form=root_cmp.items.get(0);if(basic_form)basic_form.fireEvent("purchaseMethodChange",plan_item["purchase_method_code"],!!plan_item["is_electronic"]);if(isSigleMethodSupplierItem(plan_item["purchase_method_name"])=== true)basic_form.fireEvent("changeOosStateCheckbox",false);else basic_form.fireEvent("changeOosStateCheckbox",true);var possible_procedure_type=detectProcedureTypeByMethodName(plan_item["purchase_method_name"]);if(possible_procedure_type>0)basic_form.fireEvent("changeProcedureType",possible_procedure_type);component.fireEvent("changeBasesForSmp",!!plan_item["is_purchase_ignored"],plan_item["purchase_category"])}}component.fireEvent("updateOkved2List");component.fireEvent("updateOkpd2List");component.updateOkved2ListByLoad(); component.updateOkpd2ListByLoad()}},icon:Ext.MessageBox.QUESTION})}}},{fieldLabel:"\u041f\u0440\u0435\u0434\u043c\u0435\u0442 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 (\u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e)"+REQUIRED_FIELD},{xtype:"textarea",hideLabel:true,name:"subject",maxLength:2E3,id:this.subject_id,blankText:"\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043f\u0440\u0435\u0434\u043c\u0435\u0442 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430", height:160},{xtype:"Application.components.dateField",anchor:null,fieldLabel:"\u0421\u0440\u043e\u043a \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430",format:"d.m.Y",name:"date_end_contract",allowBlank:true,hidden:Main.config.contracts_date_end_contract?false:true},{xtype:"Application.components.priceField",allowNegative:false,name:"price_cut_off",id:price_cut_off_id,minValue:.01,maxValue:999999999999,width:100,anchor:false,allowBlank:false, fieldLabel:"\u0426\u0435\u043d\u0430 \u043e\u0442\u0441\u0435\u0447\u0435\u043d\u0438\u044f"+REQUIRED_FIELD,msgTarget:"under",hidden:true},{xtype:"checkbox",hideLabel:true,hidden:!Main.config.allow_single_unit,boxLabel:"\u0422\u043e\u0440\u0433\u0438 \u0437\u0430 \u0435\u0434\u0438\u043d\u0438\u0446\u0443",name:"single_unit",listeners:{check:function(field,newVal){var price_field=Ext.getCmp(single_unit_id);if(!price_field)return;if(newVal){price_field.enable();price_field.show();component.doLayout()}else{price_field.disable(); price_field.hide()}}}},{xtype:"Application.components.priceField",allowNegative:false,name:"unit_price",id:single_unit_id,minValue:.01,maxValue:999999999999,width:100,anchor:false,hidden:true,disabled:true,fieldLabel:"\u041d\u0430\u0447\u0430\u043b\u044c\u043d\u0430\u044f \u0446\u0435\u043d\u0430 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0442\u0430"+REQUIRED_FIELD}]},{xtype:"fieldset",title:"\u0421\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0439 (\u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439) \u0446\u0435\u043d\u0435 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430", items:[{xtype:"combo",name:"price_form",ref:"../priceFormCmp",fieldLabel:"\u0424\u043e\u0440\u043c\u0430 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0446\u0435\u043d\u044b",mode:"local",store:new Ext.data.ArrayStore({fields:["id","name"],idIndex:0,data:[[PRICE_FORM_INFO_ABOUT_MAX_CONTRACT_PRICE,"\u0421\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0439 (\u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439) \u0446\u0435\u043d\u0435 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"], [PRICE_FORM_FORMULA_AND_MAX_CONTRACT_PRICE,"\u0424\u043e\u0440\u043c\u0443\u043b\u0430 \u0446\u0435\u043d\u044b \u0438 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0446\u0435\u043d\u044b \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"],[PRICE_FORM_UNIT_PRICE_AND_MAX_CONTRACT_PRICE,"\u0426\u0435\u043d\u0430 \u0435\u0434\u0438\u043d\u0438\u0446\u044b \u0442\u043e\u0432\u0430\u0440\u043e\u0432, \u0440\u0430\u0431\u043e\u0442, \u0443\u0441\u043b\u0443\u0433 \u0438 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0446\u0435\u043d\u044b \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"]]}), editable:false,valueField:"id",displayField:"name",hiddenName:"name",triggerAction:"all",value:1,listeners:{select:function(cmp,rec){var cmp_visibles={};cmp_visibles[component.start_price_id]=false;cmp_visibles[component.price_formula]=false;cmp_visibles[component.commodity_price]=false;cmp_visibles[component.max_contract_price]=false;switch(rec.get("id")){case PRICE_FORM_INFO_ABOUT_MAX_CONTRACT_PRICE:cmp_visibles[component.start_price_id]=true;break;case PRICE_FORM_FORMULA_AND_MAX_CONTRACT_PRICE:cmp_visibles[component.price_formula]= true;cmp_visibles[component.max_contract_price]=true;break;case PRICE_FORM_UNIT_PRICE_AND_MAX_CONTRACT_PRICE:cmp_visibles[component.commodity_price]=true;cmp_visibles[component.max_contract_price]=true;if(component.procedureType==Application.models.Procedure.type_ids.auction_up){var macContractPriceCmp=Ext.getCmp(component.max_contract_price);macContractPriceCmp.fireEvent("change",macContractPriceCmp,macContractPriceCmp.getValue())}break}Ext.iterate(cmp_visibles,function(cmp_id,cmp_visibility){var cmp= Ext.getCmp(cmp_id);if(cmp){cmp.setVisible(cmp_visibility);cmp.setDisabled(!cmp_visibility)}})},afterrender:function(){var val=this.getValue();var rec=this.getStore().getAt(this.getStore().findExact("id",val));this.fireEvent("select",this,rec)}}},{xtype:"Application.components.priceField",allowNegative:false,name:"start_price",id:this.start_price_id,minValue:.01,maxValue:999999999999,width:200,anchor:false,fieldLabel:"\u041d\u0430\u0447\u0430\u043b\u044c\u043d\u0430\u044f (\u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f) \u0446\u0435\u043d\u0430 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"+ REQUIRED_FIELD,listeners:{change:function(field,newVal){component.fireEvent("startpricechanged",parsePrice(newVal))}}},{xtype:"textfield",name:"price_formula",id:this.price_formula,width:200,maxLength:255,anchor:false,fieldLabel:"\u0424\u043e\u0440\u043c\u0443\u043b\u0430 \u0446\u0435\u043d\u044b, \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0449\u0430\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0440\u0430\u0441\u0447\u0435\u0442\u0430 \u0441\u0443\u043c\u043c, \u043f\u043e\u0434\u043b\u0435\u0436\u0430\u0449\u0438\u0445 \u0443\u043f\u043b\u0430\u0442\u0435"+ REQUIRED_FIELD},{xtype:"Application.components.priceField",allowNegative:false,name:"commodity_price",id:this.commodity_price,minValue:.01,maxValue:999999999999,width:200,anchor:false,fieldLabel:"\u0426\u0435\u043d\u0430 \u0442\u043e\u0432\u0430\u0440\u0430, \u0440\u0430\u0431\u043e\u0442\u044b, \u0443\u0441\u043b\u0443\u0433\u0438"+REQUIRED_FIELD,listeners:{change:function(field,newVal){if(component.procedureType==Application.models.Procedure.type_ids.auction_up)component.fireEvent("startpricechanged", parsePrice(newVal))}}},{xtype:"Application.components.priceField",allowNegative:false,name:"max_contract_price",id:this.max_contract_price,minValue:.01,maxValue:999999999999,width:200,anchor:false,fieldLabel:"\u0426\u0435\u043d\u0430 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"+REQUIRED_FIELD,listeners:{change:function(field,newVal){var commodityPriceCmp=Ext.getCmp(component.commodity_price);if(commodityPriceCmp&&commodityPriceCmp.hidden||component.procedureType!=Application.models.Procedure.type_ids.auction_up)component.fireEvent("startpricechanged", parsePrice(newVal))}}},{xtype:"checkbox",name:"start_price_with_vat",checked:true,boxLabel:"\u0421 \u0443\u0447\u0435\u0442\u043e\u043c \u041d\u0414\u0421",listeners:{check:function(cmp,value){Ext.getCmp(component.nds_percent_combo).setVisible(!!value)}}},{id:this.nds_percent_combo,xtype:"combo",name:"vat_percent",fieldLabel:"\u0420\u0430\u0437\u043c\u0435\u0440 \u041d\u0414\u0421(%)",mode:"local",store:getVATStore(),editable:true,valueField:"id",displayField:"name",hiddenName:"id",triggerAction:"all", value:Main.config.current_vat_amount||20,maskRe:/\d/,tpl:'
      {name}
      ',getValues:function(){var val=this.value;val=Ext.isString(val)?val.replace("%",""):parseFloat(val);return val},width:50},{xtype:"checkbox",name:"compare_application_without_vat",id:component.compare_application_without_vat_checkbox,fieldLabel:"\u0421\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0446\u0435\u043d\u043e\u0432\u044b\u0445 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0431\u0435\u0437 \u0443\u0447\u0435\u0442\u0430 \u041d\u0414\u0421"}, {xtype:"textarea",fieldLabel:"\u041f\u043e\u0440\u044f\u0434\u043e\u043a \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0446\u0435\u043d\u044b \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430",name:"order_pricing",allowBlank:true},{xtype:"combo",name:"many_participants",ref:"../many_participants",fieldLabel:"\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u0441 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430\u043c\u0438"+ REQUIRED_FIELD,visible:!!Main.config.contracts_allow_multiple_contracts,disabled:!Main.config.contracts_allow_multiple_contracts,mode:"local",store:new Ext.data.ArrayStore({fields:["id","name"],idIndex:0,data:[[false,"\u041d\u0435\u0442"],[true,"\u0414\u0430"]]}),editable:false,valueField:"id",displayField:"name",hiddenName:"name",triggerAction:"all",value:null,listeners:{select:function(field,data,val){component.number_of_participants.setVisible(val);component.number_of_participants.setDisabled(!val)}}}, {xtype:"combo",name:"number_of_participants",ref:"../number_of_participants",fieldLabel:"\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u044b\u0445 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u043e\u0432",mode:"local",hidden:true,allowBlank:true,store:new Ext.data.ArrayStore({fields:["id","name"],idIndex:0,data:[[2,2],[3,3],[4,4],[5,5]]}),editable:false,valueField:"id",displayField:"name",hiddenName:"name",triggerAction:"all",value:null}]}, {xtype:"fieldset",style:"margin: 10px 0 5px 0",items:[{xtype:"checkbox",qtipConfig:{html:"\u0417\u0430\u043a\u0443\u043f\u043a\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0438\u0437 \u0433\u043e\u0434\u043e\u0432\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043c\u0430 \u0437\u0430\u043a\u0443\u043f\u043e\u043a, \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430\u043c\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0441\u0443\u0431\u044a\u0435\u043a\u0442\u044b \u043c\u0430\u043b\u043e\u0433\u043e \u0438 \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u043f\u0440\u0435\u0434\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430.", autoHide:false,applyTipTo:"label",ignoreFirstWrap:true},plugins:[Ext.ux.plugins.ToolTip],hideLabel:true,boxLabel:"\u0417\u0430\u043a\u0443\u043f\u043a\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0440\u0430\u0441\u0447\u0435\u0442\u0435 \u0433\u043e\u0434\u043e\u0432\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043c\u0430 \u0437\u0430\u043a\u0443\u043f\u043e\u043a, \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430\u043c\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0443\u0431\u044a\u0435\u043a\u0442\u044b \u043c\u0430\u043b\u043e\u0433\u043e \u0438 \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u043f\u0440\u0435\u0434\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430", name:"is_purchase_ignored",ref:"../isPurchaseIgnoredCmp",listeners:{check:function(cmp,checked){component.purchaseCategoryCmp.setVisible(!!checked);component.purchaseCategoryCmp.setDisabled(!checked)}}},{xtype:"Application.components.combo",name:"purchase_category_id",fieldLabel:"\u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f \u0437\u0430\u043a\u0443\u043f\u043a\u0438 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u043f\u0443\u043d\u043a\u0442\u043e\u043c 7 \u043f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u041f\u0440\u0430\u0432\u0438\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430 \u0420\u0424 \u043e\u0442 11.12.2014 \u2116 1352", displayField:"name",valueField:"id",mode:"local",hidden:true,triggerAction:"all",editable:false,forceSelection:true,store:getBasesForSmp(true),listWidth:800,ref:"../purchaseCategoryCmp",renderer:function(recordValues){return recordValues["id"]+". "+recordValues["name"]}}]},{xtype:"fieldset",title:"\u041a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u041e\u041a\u041f\u04142",items:[{xtype:"Application.components.StoreTextList",name:"nomenclature",emptyText:"
      \u0441\u043f\u0438\u0441\u043e\u043a \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438\u0437 \u043f\u0435\u0440\u0435\u0447\u043d\u044f \u043f\u043e\u0437\u0438\u0446\u0438\u0439...
      ", ref:"../nomenclature_list",renderer:function(record){return'
      • '+record.get("value")+": "+record.get("text")+"
      "},getValues:function(){var store=this.getStore();var values=[];if(store)store.each(function(item){values.push({code:item.get("value"),full_name:item.get("text")})});return values}}]},{xtype:"fieldset",title:"\u041a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u041e\u041a\u0412\u042d\u04142",items:[{xtype:"Application.components.StoreTextList", name:"okved2",emptyText:"
      \u0441\u043f\u0438\u0441\u043e\u043a \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438\u0437 \u043f\u0435\u0440\u0435\u0447\u043d\u044f \u043f\u043e\u0437\u0438\u0446\u0438\u0439...
      ",ref:"../okved2_list",renderer:function(record){return'
      • '+record.get("value")+": "+record.get("text")+ "
      "},getValues:function(){var store=this.getStore();var values=[];if(store)store.each(function(item){values.push({code:item.get("value"),full_name:item.get("text")})});return values}}]},{xtype:"Application.components.productAddPositional",id:this.add_positional_id,disabled:true,hidden:true},{xtype:"Application.components.productList",id:this.products_list_id,parent:component,ref:"product_list",module_type:component.module_type}],listeners:{openpurchaseplandialog:function(){this.planPositionSelectPanelCmp.fireEvent("opendialog")}, afterlayout:function(){this.planPositionSelectPanelCmp.doLayout()}},setValues:function(v){setComponentValues(this,v,true);component.number_of_participants.setVisible(v.many_participants);component.number_of_participants.setDisabled(!v.many_participants);Ext.getCmp(component.products_list_id).setValues(v.lot_units);Ext.getCmp(component.add_positional_id).setValues(v.lot_units);component.fireEvent("startpricechanged",parsePrice(v.start_price))}});this.listeners=this.listeners||{};Ext.apply(this.listeners, {updateOkved2List:function(){if(component.product_list.products.length>0){var records=[];Ext.each(component.product_list.products,function(item,index){var data=item.okved2_code.input.getValueRecordData();if(!isEmpty(data))records.push({value:data.code,text:data.name||""})});component.okved2_list.setStore(new Ext.data.JsonStore({data:{rows:records},root:"rows",idProperty:"value",fields:["value","text"]}))}else component.okved2_list.setStore(null)},updateOkpd2List:function(){if(component.product_list.products.length> 0){var records=[];Ext.each(component.product_list.products,function(item,index){var data=item.okpd2_code.input.getValueRecordData();if(!isEmpty(data))records.push({value:data.code,text:data.name||""})});component.nomenclature_list.setStore(new Ext.data.JsonStore({data:{rows:records},root:"rows",idProperty:"value",fields:["value","text"]}))}else component.nomenclature_list.setStore(null)},procedurechanged:function(p){var d=false;component.procedureType=p;if(Application.models.Procedure.type_ids.qualification== p)d=true;for(var i=0;i0){var records=[];Ext.each(this.loaded_okved,function(data,index){if(!isEmpty(data))records.push({value:data.code,text:data.name||""})});this.okved2_list.setStore(new Ext.data.JsonStore({data:{rows:records},root:"rows",idProperty:"value",fields:["value","text"]}))}else component.okved2_list.setStore(null)},updateOkpd2ListByLoad:function(){if(this.loaded_okpd.length>0){var records=[];Ext.each(this.loaded_okpd,function(data, index){if(!isEmpty(data))records.push({value:data.code,text:data.name||""})});this.nomenclature_list.setStore(new Ext.data.JsonStore({data:{rows:records},root:"rows",idProperty:"value",fields:["value","text"]}))}else component.nomenclature_list.setStore(null)}});Ext.define("Application.components.procedureViewPanel",{extend:"Ext.panel.Panel",autoHeight:true,fields:{"registry_number":"\u041d\u043e\u043c\u0435\u0440 \u0438\u0437\u0432\u0435\u0449\u0435\u043d\u0438\u044f:","remote_id":"\u041d\u043e\u043c\u0435\u0440 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b:","title":"\u041d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b:","with_prequalification":"\u0421 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435\u043c \u043a\u0432\u0430\u043b\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u043e\u0442\u0431\u043e\u0440\u0430:", "procedure_type_vocab":"\u0424\u043e\u0440\u043c\u0430 \u0442\u043e\u0440\u0433\u043e\u0432:","purchase_method_name":"\u0422\u0438\u043f \u0437\u0430\u043a\u0443\u043f\u043a\u0438 \u043d\u0430 \u0415\u0418\u0421","peretorg_possible":"\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u043f\u0435\u0440\u0435\u0442\u043e\u0440\u0436\u043a\u0438:","date_published":"\u0414\u0430\u0442\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438:", "offers_step_min":"\u0428\u0430\u0433 \u0446\u0435\u043d\u043e\u0432\u044b\u0445 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043e\u0442:","offers_step_max":"\u0428\u0430\u0433 \u0446\u0435\u043d\u043e\u0432\u044b\u0445 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0434\u043e:","step_is_exact":"\u0428\u0430\u0433 \u0443\u043a\u0430\u0437\u0430\u043d \u0432:","step_reduction":"\u0428\u0430\u0433 \u043f\u043e\u043d\u0438\u0436\u0435\u043d\u0438\u044f:", "step_auction":"\u0428\u0430\u0433 \u0430\u0443\u043a\u0446\u0438\u043e\u043d\u0430:","offers_wait_time":"\u0412\u0440\u0435\u043c\u044f \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f \u0446\u0435\u043d\u043e\u0432\u044b\u0445 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0439:","procedure_subject_codes":"\u041a\u043e\u0434 \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u0430 \u0437\u0430\u043a\u0443\u043f\u043a\u0438","procedure_inner_classification":"\u041a\u043e\u0434 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u0437\u0430\u043a\u0443\u043f\u043a\u0438", "paper_form":"\u0417\u0430\u044f\u0432\u043a\u0438 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0442\u0441\u044f \u0432 \u0431\u0443\u043c\u0430\u0436\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u0435","not_dishonest":"\u0422\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0435 \u043a \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044e \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430 \u0432 \u0420\u041d\u041f","price_increase":"\u0426\u0435\u043d\u043e\u0432\u044b\u0435 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u0435", "skip_fees":"\u0411\u0435\u0437 \u0441\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043f\u043b\u0430\u0442\u044b \u0437\u0430 \u0443\u0441\u043b\u0443\u0433\u0438 \u042d\u0422\u041f","purchase_inside_avtodor":"\u0417\u0430\u043a\u0443\u043f\u043a\u0430 \u0432\u043d\u0443\u0442\u0440\u0438 \u0413\u0440\u0443\u043f\u043f\u044b \u041a\u043e\u043c\u043f\u0430\u043d\u0438\u0439 \u00ab\u0410\u0432\u0442\u043e\u0434\u043e\u0440\u00bb","sell_contract":"\u0414\u043e\u0433\u043e\u0432\u043e\u0440 \u043d\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e"}, initComponent:function(){var fieldset_id=Ext.id();this.addEvents("dataload");if(!isCustomer()&&!isAdmin())delete this.fields.remote_id;this.items=[{xtype:"Application.components.keyValue2Panel",title:"\u0421\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435",style:"margin: 5px 5px 0px 5px;",fields:this.fields,fieldsShowAlways:["step_is_exact"],id:fieldset_id,templates:{title:Ext.util.Format.title,date_published:Ext.util.Format.localDateText,offers_step_min:Ext.util.Format.formatOffersStep, offers_step_max:Ext.util.Format.formatOffersStep,step_is_exact:function(v){return v?"\u0432\u0430\u043b\u044e\u0442\u0435 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430":"\u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0430\u0445 \u043e\u0442 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0439 \u0446\u0435\u043d\u044b \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"},procedure_type_vocab:'{procedure_type_vocab} c \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435\u043c \u043a\u0432\u0430\u043b\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u043e\u0442\u0431\u043e\u0440\u0430', offers_wait_time:"{offers_wait_time} \u043c\u0438\u043d\u0443\u0442",procedure_subject_codes:new Ext.XTemplate(''+''+"{values.full_name}
      "+"
      "+"
      "),procedure_inner_classification:new Ext.XTemplate(''+''+"{values.full_name}
      "+"
      "+"
      "),step_reduction:Ext.util.Format.formatPrice,step_auction:Ext.util.Format.formatPrice, registry_number:function(v){if(this.values&&this.values.url_oos)return''+v+"";return v},not_dishonest:function(v){return v==1?"\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e":"\u041d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e"},purchase_inside_avtodor:function(v){return v==1?"\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e":"\u041d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e"}, skip_fees:function(v){return v==1?"\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e":"\u041d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e"},sell_contract:function(v){return v==1?"\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e":"\u041d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e"}}}];this.on("added",function(){var fieldSet=this.getComponent(0);this.relayEvents(fieldSet,["dataload"]);if(this.procedureAutoLoad&& this.procedure_id&&this.tplData===undefined){var params={mask:true,mask_el:this.getEl(),scope:fieldSet,monitor_valid:this};var data={procedure_id:this.procedure_id,is_view:1};if(this.procedureLoadDraft)data.load_draft=1;performRPCCall(RPC.Procedure.load,[data],params,function(resp){if(resp&&resp.success){if(resp.procedure)var show_customer_fields=false;if(isAdmin())show_customer_fields=true;if(resp.procedure.lots&&resp.procedure.lots[0]&&resp.procedure.lots[0]["lot_customers"])Ext.each(resp.procedure.lots[0]["lot_customers"], function(lot_customer){if(lot_customer.id==Main.contragent.id)show_customer_fields=true});fieldSet.loadData(resp.procedure);if(!show_customer_fields){fieldSet.hideKey("skip_fees");fieldSet.hideKey("purchase_inside_avtodor")}if(resp.procedure["skip_fees"]!==true)fieldSet.hideKey("skip_fees");if(resp.procedure["purchase_inside_avtodor"]!==true)fieldSet.hideKey("purchase_inside_avtodor");if(resp.procedure["frm"]){fieldSet.hideKey("step_is_exact");fieldSet.hideKey("purchase_method_name");fieldSet.hideKey("peretorg_possible")}if(in_array(resp.procedure["procedure_type"], [PROCEDURE_PRICE_REQUEST,PROCEDURE_CONCURRENT_PROCEDURE]))fieldSet.hideKey("step_is_exact");if(!in_array(resp.procedure["procedure_type"],[PROCEDURE_TYPE_AUC_ASC,PROCEDURE_TYPE_AUC_DESC])){fieldSet.hideKey("offers_step_min");fieldSet.hideKey("offers_step_max");fieldSet.hideKey("offers_wait_time");fieldSet.hideKey("peretorg_possible")}if(resp.procedure["sell_contract"]!==true)fieldSet.hideKey("sell_contract")}else if(resp)echoResponseMessage(resp)})}else fieldSet.loadData(this.tplData)},this);Application.components.procedureViewPanel.superclass.initComponent.call(this); this.on("render",function(){Ext.getCmp(fieldset_id).on("dataload",function(v){if(!v)return;this.hideKey("with_prequalification");if(v.procedure_type==Application.models.Procedure.type_ids.pricelist||v.procedure_type==Application.models.Procedure.type_ids.paper_pricelist||v.procedure_type==Application.models.Procedure.type_ids.contest||v.procedure_type==Application.models.Procedure.type_ids.paper_contest||v.procedure_type==Application.models.Procedure.type_ids.contest_in_two_steps||v.procedure_type== Application.models.Procedure.type_ids.paper_contest_in_two_steps||v.procedure_type==Application.models.Procedure.type_ids.quotation||v.procedure_type==Application.models.Procedure.type_ids.paper_quotation||v.procedure_type==Application.models.Procedure.type_ids.qualification)this.hideKeyForced("step_is_exact");if(Application.models.Procedure.groups.auctions.indexOf(v.procedure_type)<0){this.hideKey("offers_step_min");this.hideKey("offers_step_max");this.hideKey("step_is_exact");this.hideKey("offers_wait_time")}if(v.procedure_type!= Application.models.Procedure.type_ids.public_sale){this.hideKey("step_reduction");this.hideKey("step_auction")}else{this.hideKey("offers_step_min");this.hideKey("offers_step_max");this.hideKeyForced("step_is_exact")}if(v.middle_small_business==true)v.middle_small_business="\u0414\u0430";else v.middle_small_business="He\u0442";if(v.paper_form==false){this.hideKey("paper_form");this.hideKeyForced("paper_form")}else v.paper_form="\u0414\u0430";if(v.peretorg_possible&&v.peretorg_possible==true)v.peretorg_possible= "\u0414\u0430";else v.peretorg_possible="\u041d\u0435\u0442";if(v.with_prequalification&&v.with_prequalification==true)v.with_prequalification="\u0414\u0430";else v.with_prequalification="\u041d\u0435\u0442";if(!!Main.config.hide_on_view_panel_step_auction){this.hideKeyForced("step_reduction");this.hideKeyForced("step_auction")}if(!!Main.config.hide_on_view_panel_with_prequalification)this.hideKeyForced("with_prequalification");if(!Main.config.middle_small_business)this.hideKeyForced("middle_small_business"); if(v.price_increase==true)v.price_increase="\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e";else{this.hideKey("price_increase");this.hideKeyForced("price_increase")}})},this,{once:true})}});Ext.define("Application.components.productAddPositional",{extend:"Ext.form.FieldSet",initComponent:function(){this.products_panel=new Ext.Panel({items:[]});Ext.apply(this,{title:"\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0437\u0430\u043a\u0443\u043f\u043e\u0447\u043d\u044b\u0435 \u043f\u043e\u0437\u0438\u0446\u0438\u0438",anchor:"100%",defaults:{border:true},items:[this.products_panel],bodyCssClass:"subpanel",bodyStyle:"padding-top: 0;",style:"padding-bottom: 0;",buttons:[{text:"\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0437\u0430\u043a\u0443\u043f\u043e\u0447\u043d\u0443\u044e \u043f\u043e\u0437\u0438\u0446\u0438\u044e", scope:this,handler:function(){this.addProduct()}},{text:"\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0437\u0430\u043a\u0443\u043f\u043e\u0447\u043d\u044b\u0435 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 CSV",scope:this,handler:function(){}}],listeners:{scope:this,productremove:function(p){this.removeProductsItem(p);this.doLayout()}}});Application.components.productList.superclass.initComponent.call(this)},addProduct:function(value,nolayout){var insertProduct= function(){var p=new Application.components.productPositionForm({parent:this,name:"lot_units[]",value:value});this.products_panel.add(p);if(!nolayout)this.doLayout()};ensureStoreLoaded(getOkeiStore(),insertProduct,this)},getProductsItems:function(){return this.products_panel.items},removeProductsItem:function(i){return this.products_panel.remove(i)},setValues:function(lot_units){if(Ext.isEmpty(lot_units)||!Ext.isDefined(lot_units.length)||lot_units.length==0)return;var updateProducts=function(){var i; var to_del=[];this.getProductsItems().each(function(i){to_del.push(i)});for(i=0;i-1)this.com_items.push({xtype:"Application.components.multiSelectCombo",name:"po_model_lotunittargetobjects",fieldLabel:"\u0426\u0435\u043b\u0435\u0432\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442"+ REQUIRED_FIELD,allowBlank:false,readOnly:this.isDisabled?this.isDisabled:false,store:getTargetObjectsStore(),displayField:"name",hidden:!Main.config.rad_custom,depKey:"vocab_id"},{xtype:"Application.components.multiSelectCombo",name:"po_model_lotunitbasisesfordirect",fieldLabel:"\u041e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u043b\u044f \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043f\u043e \u043f\u0440\u044f\u043c\u043e\u0439 \u0437\u0430\u043a\u0443\u043f\u043a\u0435", readOnly:this.isDisabled?this.isDisabled:false,store:getBasisesForDirectStore(),displayField:"short_name",hidden:!Main.config.rad_custom,depKey:"vocab_id"},{xtype:"Application.components.multiSelectCombo",name:"po_model_lotunitnomenclaturegroups",fieldLabel:"\u041d\u043e\u043c\u0435\u043d\u043a\u043b\u0430\u0442\u0443\u0440\u043d\u0430\u044f \u0433\u0440\u0443\u043f\u043f\u0430",readOnly:this.isDisabled?this.isDisabled:false,store:getNomenclatureGroupsStore(),displayField:"full_name",hidden:!Main.config.rad_custom, depKey:"vocab_id"});this.po_items.push({xtype:"Application.components.combo",fieldLabel:"\u0415\u0434\u0438\u043d\u0438\u0446\u0430 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f",name:"okei_code",hiddenName:"okei_code",displayField:"name",valueField:"code",forceSelection:true,triggerAction:"all",mode:"local",allowBlank:true,store:getOkeiStore(),readOnly:this.isDisabled?this.isDisabled:false,id:this.okei_id,hidden:Main.config.okei_code_hide&&component.isInnovation},{xtype:"Application.components.priceField", allowNegative:false,allowDecimal:true,minValue:.01,maxValue:999999999999,allowBlank:true,fieldLabel:"\u0426\u0435\u043d\u0430 \u0437\u0430 \u0435\u0434\u0438\u043d\u0438\u0446\u0443, \u0440\u0443\u0431",name:"price",id:this.price_id,readOnly:this.isDisabled?this.isDisabled:false,hidden:Main.config.price_id_hide&&component.isInnovation,listeners:{change:function(newVal){component.fireEvent("startpricechanged",parsePrice(newVal));if(Ext.getCmp(component.quantity_id).getValue()!=null){Ext.getCmp(component.total_id).setValue(Ext.getCmp(component.price_id).getValue()* Ext.getCmp(component.quantity_id).getValue());Ext.getCmp(component.total_id).fireEvent("change")}}}},{xtype:"Application.components.quantityField",fieldLabel:"\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e",renderPrecision:false,allowBlank:true,maxLength:20,name:"quantity",id:this.quantity_id,readOnly:this.isDisabled?this.isDisabled:false,hidden:Main.config.quantity_id_hide&&component.isInnovation,listeners:{change:function(field,newValue,oldValue){if(Ext.getCmp(component.price_id).getValue()!= null){Ext.getCmp(component.total_id).setValue(Ext.getCmp(component.price_id).getValue()*Ext.getCmp(component.quantity_id).getValue());Ext.getCmp(component.total_id).fireEvent("change")}Ext.getCmp(component.current_year_quantity_id).quantityChanged(newValue)},added:function(){if(component.product_quantity!=undefined&&component.product_quantity!=null&&component.product_quantity!="free"){this.setValue(component.product_quantity);this.setReadOnly(true)}}}},{xtype:"Application.components.quantityField", fieldLabel:"\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u043e\u0432\u0430\u0440\u0430 (\u043e\u0431\u044a\u0435\u043c) \u043f\u043e\u0441\u0442\u0430\u0432\u043a\u0438 \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u0433\u043e\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f "+t("\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430"),renderPrecision:false,allowBlank:true,maxLength:20,name:"current_year_quantity",maxValue:999999999999,minValue:0, id:this.current_year_quantity_id,readOnly:this.isDisabled?this.isDisabled:false,quantityChanged:function(value){this.setValue(value);this.maxValue=value;this.validate()}},{xtype:"Application.components.priceField",fieldLabel:"\u0418\u0442\u043e\u0433\u043e \u043f\u043e \u043f\u043e\u0437\u0438\u0446\u0438\u0438, \u0440\u0443\u0431",name:"total",minValue:.01,maxValue:999999999999,allowBlank:true,emptyText:"\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0446\u0435\u043d\u044b \u043d\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e", id:this.total_id,readOnly:true,ref:"total",hidden:Main.config.total_id_hide&&component.isInnovation,listeners:{change:function(){component.fireEvent("recalc")},afterrender:function(){Ext.QuickTips.init();Ext.QuickTips.register({target:component.total_id,text:'\u041f\u043e\u043b\u0435 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 "\u0426\u0435\u043d\u0430 \u0437\u0430 \u0435\u0434\u0438\u043d\u0438\u0446\u0443, '+ RUB_SIGN+'" \u0438 "\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e" \u044d\u0442\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438.',width:300,dismissDelay:2E4})},destroy:function(){Ext.QuickTips.unregister(component.total_id)}}});this.com_items.push({xtype:"combo",fieldLabel:"\u0422\u0438\u043f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0437\u0430\u043a\u0443\u043f\u043a\u0438",name:"type_object_purchase",displayField:"name",valueField:"id",editable:false,mode:"local",allowBlank:true, triggerAction:"all",value:component.isInnovation?101:null,store:Application.models.Procedure.getTypeObjectPurchaseStore()},{xtype:"Application.components.quantityField",fieldLabel:"\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e",renderPrecision:false,allowBlank:true,maxLength:20,name:"quantity"},{xtype:"textfield",fieldLabel:"\u041f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0442\u043e\u0440\u0433\u043e\u0432\u0430\u044f \u043c\u0430\u0440\u043a\u0430", allowBlank:true,maxLength:255,name:"trademark"},{xtype:"Application.components.combo",fieldLabel:"\u0415\u0434\u0438\u043d\u0438\u0446\u0430 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f",name:"okei_code",hiddenName:"okei_code",displayField:"name",valueField:"code",forceSelection:true,triggerAction:"all",mode:"local",allowBlank:true,store:getOkeiStore()});this.com_items.unshift(this.getOKVED2CodeSet());this.com_items.unshift(this.getOKPD2CodeSet());var removeFn=function(){var cmp=this.findParentByType("panel"); if(!cmp)return;cmp=cmp.findParentByType("panel");component.remove(cmp);component.doLayout()};Ext.apply(this,{defaults:{anchor:"100%",allowBlank:false,border:false},bodyStyle:"padding-top: "+(Ext.isIE?"20":"0")+"px;",style:"margin-top: 10px; margin-bottom: 0; padding-bottom: 3px;",layout:"form",items:component.createItems(),buttons:[{text:"\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0435 \u043a \u0442\u043e\u0432\u0430\u0440\u0443",disabled:this.isDisabled? this.isDisabled:false,hidden:!Main.config.detailed_requirements,handler:function(){component.add(new Application.components.lotRequirement({parent:component}));component.doLayout()}},{text:"\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0442\u043e\u0432\u0430\u0440",disabled:this.isDisabled?this.isDisabled:false,handler:function(){component.parent.fireEvent("productremove",component);component.parent.parent.fireEvent("updateOkpd2List");component.parent.parent.fireEvent("updateOkved2List")}}],listeners:{afterrender:function(){if(this.productsDisableFlag)this.disableFieldsEdit()}}, getValues:function(){var v={};if(this.product_id)v.id=this.product_id;collectComponentValues(this,v,true);if(v.name==""&&v.trademark=="");return v},setValues:function(v){this.product_id=v.id;setComponentValues(this,v,true);if(v.requirements){this.items.each(function(c){if(c.requirement)component.remove(c)});for(var i=0;i"+'1 \u0441\u043f\u043e\u0441\u043e\u0431:\t\u0412\u0440\u0443\u0447\u043d\u0443\u044e \u0432\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044f "\u041d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u0437\u0438\u0446\u0438\u0438".
      '+ "2 \u0441\u043f\u043e\u0441\u043e\u0431:\t\u041f\u043e\u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e \u0432\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044e \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u0438\u0437 \u043f\u0440\u0438\u043a\u0440\u0435\u043f\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0441\u043f\u0438\u0441\u043a\u0430 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0439. \u0417\u0430\u0442\u0435\u043c \u0432\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0438\u043b\u0438 \u043e\u043f\u0438\u0448\u0438\u0442\u0435 \u043d\u043e\u0432\u0443\u044e."; else return"\u0417\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0435\u0441\u043b\u0438 \u043b\u043e\u0442 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0449\u0438\u0445\u0441\u044f \u0442\u043e\u0432\u0430\u0440\u043d\u044b\u0445 \u043f\u043e\u0437\u0438\u0446\u0438\u0439 \u0438\u043b\u0438 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 223-\u0424\u0417."+ " \u0415\u0441\u043b\u0438 \u043a\u043e\u0434\u044b \u041e\u041a\u041f\u04142 \u0438 \u041e\u041a\u0412\u042d\u04142 \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u0442\u043e\u0432\u0430\u0440\u043e\u0432/\u0443\u0441\u043b\u0443\u0433 \u0432 \u0441\u043e\u0441\u0442\u0430\u0432\u0435 \u043b\u043e\u0442\u0430 - \u0432\u0432\u0435\u0434\u0438\u0442\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u043f\u043e\u043b\u044f \u043d\u0438\u0436\u0435. "+ "\u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0435\u0441\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043a\u043e\u0434\u044b \u0434\u043b\u044f \u0442\u043e\u0432\u0430\u0440\u043e\u0432/\u0443\u0441\u043b\u0443\u0433 \u043d\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f - \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435\u0441\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c\u0438 \u0444\u043e\u0440\u043c\u0430\u043c\u0438 \u0432\u044b\u0431\u043e\u0440\u0430 \u043a\u043e\u0434\u043e\u0432 \u0432\u044b\u0448\u0435."}()}, this.products_panel],bodyCssClass:"subpanel",bodyStyle:"padding-top: 0;",style:"padding-bottom: 0;",buttons:[{text:"\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0442\u043e\u0432\u0430\u0440",scope:this,disabled:this.isDisabled?this.isDisabled:false,handler:function(){this.addProduct()}}],listeners:{scope:this,productremove:function(p){this.removeProductsItem(p);this.doLayout()}}});Application.components.productList.superclass.initComponent.call(this)},addProduct:function(value,nolayout){var component= this;var insertProduct=function(){component.products.push(new Application.components.productForm({parent:this,name:"lot_units[]",number:component.products.length,product_quantity:this.product_quantity?this.product_quantity:"free",value:value,isDisabled:this.isDisabled,productsDisableFlag:this.productsDisableFlag,module_type:this.module_type,isInnovation:this.isInnovation,listeners:{recalc:function(){if(this.module_type=="po"){var sum=0;Ext.each(component.products,function(item,key){sum+=item.total.getValue()}); component.fireEvent("recalc",sum)}}}}));this.products_panel.add(component.products.slice(-1)[0]);if(!nolayout)this.doLayout()};ensureStoreLoaded(getOkeiStore(),insertProduct,this)},getProductsItems:function(){return this.products_panel.items},removeProductsItem:function(i){this.products_panel.remove(i);this.products.remove(i);if(i.number==0)if(this.products.length>0)this.products[0].setUnitFirst();if(this.products.length)this.products[0].fireEvent("recalc");else this.fireEvent("recalc",0);return true}, setValues:function(lot_units){if(Ext.isEmpty(lot_units)||!Ext.isDefined(lot_units.length)||lot_units.length==0)return;var updateProducts=function(){var i;var to_del=[];this.getProductsItems().each(function(i){to_del.push(i)});for(i=0;i0)for(var j=0;j\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d, \u0434\u0432\u0430\u0436\u0434\u044b \u043a\u043b\u0438\u043a\u043d\u0443\u0432 \u043f\u043e \u0435\u0433\u043e \u0438\u043c\u0435\u043d\u0438 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435. "+ "\u0414\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0438\u043b\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0432\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0435\u0433\u043e \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u0438 \u043d\u0430\u0436\u043c\u0438\u0442\u0435
      "+"\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u043a\u043d\u043e\u043f\u043a\u0443.

      "}],listeners:{beforeedit:function(e){if(!e.record.data.id)return false; return true}}}],buttons:[{text:"\u041e\u0442\u043c\u0435\u043d\u0438\u0442\u044c",handler:function(){this.close()},scope:this}],getSelectedTemplate:function(){var cmp=Ext.getCmp(grid_id);if(!cmp)return false;cmp=cmp.getSelectionModel().getSelectedCell();if(!cmp)return false;cmp=store.getAt(cmp[0]);return cmp}});if(this.mode.indexOf("load")>=0)this.buttons.unshift({text:"\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c",id:load_id,handler:function(){var component=this;var id=this.getSelectedTemplate(); if(!id||!id.data||!id.data.id){Ext.Msg.alert("\u041e\u0448\u0438\u0431\u043a\u0430","\u0412\u044b \u043d\u0435 \u0432\u044b\u0431\u0440\u0430\u043b\u0438 \u0448\u0430\u0431\u043b\u043e\u043d \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438");return}id=id.data.id;if(id<=0){Ext.Msg.alert("\u041e\u0448\u0438\u0431\u043a\u0430","\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0448\u0430\u0431\u043b\u043e\u043d"); return}var info={id:id,procedure_id:this.procedure_id};RPC.Procedure.loadFileTemplate(info,function(result){if(result.success)component.fireEvent("templateloaded",result.procedure)})},scope:this});if(this.mode.indexOf("save")>=0){store.on("load",function(){var newtemplate=new store.recordType({id:0,title:"[\u041d\u043e\u0432\u044b\u0439 \u0448\u0430\u0431\u043b\u043e\u043d]"});newtemplate.phantom=false;store.insert(0,newtemplate)});this.buttons.unshift({text:"\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c", id:save_id,hidden:true,handler:function(){var component=this;var title="\u0421\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0430";var prompt="\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0438\u043c\u044f \u0434\u043b\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u0430";var id=this.getSelectedTemplate();var tpl_title="";if(id&&id.data&&id.data.id>0){prompt="\u0412\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d \u00ab"+ id.data.title+"\u00bb?
      "+"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043d\u043e\u0432\u043e\u0435 \u0438\u043c\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u0430";tpl_title=id.data.title;id=id.data.id}else id=0;Ext.Msg.prompt(title,prompt,function(b,txt){if("ok"==b){if(""==txt){Ext.Msg.alert("\u041e\u0448\u0438\u0431\u043a\u0430","\u0418\u043c\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043f\u0443\u0441\u0442\u044b\u043c"); return}var params={id:id,title:txt,contragent_id:Main.contragent.id};RPC.Procedure.saveTemplate(params,this.procedure_template,function(result){store.reload();echoResponseMessage(result);if(Main.config.template_show_dapartment&&result.success){(function(){Ext.MessageBox.hide()}).defer(1500);component.close()}})}},this,false,tpl_title)},scope:this});if(Main.config.transfer_load_from_template_button)this.buttons.unshift({text:"\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c",id:load_id,hidden:true, handler:function(){var component=this;var id=this.getSelectedTemplate();if(!id||!id.data||!id.data.id){Ext.Msg.alert("\u041e\u0448\u0438\u0431\u043a\u0430","\u0412\u044b \u043d\u0435 \u0432\u044b\u0431\u0440\u0430\u043b\u0438 \u0448\u0430\u0431\u043b\u043e\u043d \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438");return}id=id.data.id;if(id<=0){Ext.Msg.alert("\u041e\u0448\u0438\u0431\u043a\u0430","\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0448\u0430\u0431\u043b\u043e\u043d"); return}RPC.Procedure.loadTemplate(id,function(result){if(result.success)component.fireEvent("templateloaded",result.procedure)})},scope:this})}Application.components.templateGrid.superclass.initComponent.call(this)}});Ext.define("Application.components.ProtocolEditPanel",{extend:"Ext.form.Panel",frame:true,border:false,autoHeight:true,fileUpload:true,lot_id:null,type_id:null,initComponent:function(){var me=this;me.ids=initIds(["OosProtocolPublicationFieldset_id","protocolsUploadId"]);me.addEvents("onCancel");me.addEvents("protocolSigned");me.addEvents("loadProtocolFiles");me.addEvents("signForm");me.protocols=[];Ext.apply(me,{items:[{xtype:"hidden",name:"lot_id",value:me.lot_id},{xtype:"hidden",name:"type_id", value:me.type_id},{xtype:"Application.components.OosProtocolPublicationFieldset",id:me.ids["OosProtocolPublicationFieldset_id"]},{xtype:"fieldset",title:"\u041f\u0440\u043e\u0442\u043e\u043a\u043e\u043b",withDescr:false,descr:'

      \u0410\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u043c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0444\u0430\u0439\u043b \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430. \u0415\u0441\u043b\u0438 \u0432\u0430\u0448 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u043c\u043d\u043e\u0433\u043e\u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u0439, \u0442\u043e \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u0439\u0442\u0435 \u0441\u043a\u0430\u043d\u044b \u0432 \u0430\u0440\u0445\u0438\u0432\u0435, \u043b\u0438\u0431\u043e \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 Word.

      ', items:[{xtype:"Application.components.multiuploadPanel",uploadHandler:RPC.Protocol.update,id:me.ids.protocolsUploadId,deleteHandler:RPC.Protocol.deleteProtocol,name:"protocols",simultaneousUpload:false,autoUpload:true,required:false,requiredDescr:false,width:750,listeners:{beforeupload:function(cmp){cmp.uploadParams.only_file=true;cmp.uploadParams.type_id=me.type_id;cmp.uploadParams.lot_id=me.lot_id;cmp.uploadParams.req_id=1;cmp.uploadParams.requirement_id=1},uploadcomplete:function(result,action){if(result.success)me.protocols= me.protocols.concat(result.protocols)}}}]}],buttons:[{text:"\u041f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c \u0438 \u043d\u0430\u043f\u0440\u0430\u0432\u0438\u0442\u044c",handler:function(){performSave(me,null,"signForm",true,false,{loaded_protocols:me.protocols})}},{text:"\u041e\u0442\u043c\u0435\u043d\u0430",handler:function(){me.fireEvent("onCancel",me)}}],listeners:{afterrender:function(){me.fireEvent("loadProtocolFiles")},signForm:function(resp){if(!resp.result.success){echoResponseMessage(resp.result); return}var win=new Application.components.promptWindow({title:"\u041f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430",cmpType:"Application.components.SignatureForm",width:600,parentCmp:me,cmpParams:{api:RPC.Protocol.signUpdate,signatureText:resp.result["message"]||"",signatureTextHeight:400,useFormHandler:false,items:convertObjectToFormElements({lot_id:me.lot_id,type_id:me.type_id}),success_fn:function(resp){win.close();if(resp.success)echoResponseMessage(resp, function(){me.fireEvent("protocolSigned",me)});else echoResponseMessage(resp)}}});win.show()},loadProtocolFiles:function(){performRPCCall(RPC.Protocol.getProtocolsByLot,[{lot_id:me.lot_id,type_id:me.type_id,include_types:true}],{wait_delay:0,wait_text:"\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u044e\u0442\u0441\u044f \u0444\u0430\u0439\u043b\u044b \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u0432. \u041f\u043e\u0434\u043e\u0436\u0434\u0438\u0442\u0435..."},function(resp){if(!resp||!resp.success){echoResponseMessage(resp); return}if(resp["oos_types"]){var cmp=Ext.getCmp(me.ids["OosProtocolPublicationFieldset_id"]);cmp.fireEvent("setOosTypesStore",resp["oos_types"])}if(!isEmpty(resp["protocols"])){var protocols=[];Ext.iterate(resp["protocols"],function(current_protocol){var p=current_protocol;if(3==p.html[0].status){p.html[0].obsolete=true;p.html[0].obsolete_text="\u043d\u0435 \u0430\u043a\u0442\u0443\u0430\u043b\u0435\u043d"}if(p.actual)protocols.push(p)});Ext.getCmp(me.ids.protocolsUploadId).setValues(getFilesFromProtocols(protocols))}})}}}); Application.components.ProtocolEditPanel.superclass.initComponent.call(this);me.form.api={submit:RPC.Protocol.update}}});Ext.define("Application.components.ProtocolExchangeGrid",{extend:"Ext.grid.Panel",frame:true,border:false,initComponent:function(){var store=new Ext.data.DirectStore({directFn:RPC.Protocol.loadooslist,paramsAsHash:true,autoSave:true,root:"data",idProperty:"id",totalProperty:"totalCount",fields:["id","type_name","oos_publish_status","oos_registry_number","oos_publish_status_id","type_id"],baseParams:{procedure_id:this.procedure_id},remoteSort:true});Ext.apply(this,{store:store,columns:[{header:"\u0422\u0438\u043f \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 \u043d\u0430 \u043f\u043b\u043e\u0449\u0430\u0434\u043a\u0435", width:160,dataIndex:"type_name",sortable:false},{header:"\u0421\u0442\u0430\u0442\u0443\u0441 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u043d\u0430 \u0415\u0418\u0421",dataIndex:"oos_publish_status",width:80,sortable:false},{header:"\u0422\u0435\u043a\u0443\u0449\u0438\u0439 \u0440\u0435\u0435\u0441\u0442\u0440\u043e\u0432\u044b\u0439
      \u043d\u043e\u043c\u0435\u0440 \u043d\u0430 \u0415\u0418\u0421",dataIndex:"oos_registry_number",width:80,sortable:false},{header:"\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u0438", dataIndex:"extra",sortable:false,width:30,xtype:"textactioncolumn",actionsSeparator:" ",items:[{tooltip:"\u041f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u043d\u0430 zakupki.gov.ru",icon:"/ico/form.png",scope:this,isHidden:function(v,m,r){if(isAdmin())return false;else if(r.data.oos_publish_status_id<=0)return false;return true},handler:function(grid,rowIndex){this.showExchangeForm(this.getStore().getAt(rowIndex),this)}}]}],viewConfig:{forceFit:true},bbar:renderPagingToolbar("\u0417\u0430\u043f\u0438\u0441\u0438", store,50),loadMask:true,listeners:{render:function(){var store=this.getStore();store.load()}}});Application.components.ProtocolExchangeGrid.superclass.initComponent.call(this)},showExchangeForm:function(record,grid){var winId=Ext.id(),frmId=Ext.id();var procedure_id=this.procedure_id;var eventWindow=new Ext.Window({closeAction:"close",width:800,height:250,layout:"fit",id:winId,title:"\u041f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430", items:[{xtype:"Application.components.ProtocolOOSPublisForm",grid:grid,winId:winId,protocol_id:record.data.id,procedure_id:procedure_id,height:229,labelWidth:250}]});eventWindow.show()}});Ext.define("Application.components.ProtocolListPanel",{extend:"Ext.panel.Panel",frame:true,border:false,bodyCssClass:"subpanel",lotData:null,initComponent:function(){var component=this;Ext.apply(this,{items:[{html:'
      \u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u043f\u043e\u0434\u043e\u0436\u0434\u0438\u0442\u0435
      '}],buttons:[{text:"\u041d\u0430\u0437\u0430\u0434",handler:function(){history.back()}}],listeners:{beforerender:function(){RPC.Lot.load(component.lot_id, function(resp){if(resp.success){var lotData=resp.procedure,lotDataForTemplate=lotData.lot;component.lotData=lotData;lotDataForTemplate.procedure_registry_number=lotData.registry_number;lotDataForTemplate.currency_vocab=lotData.currency_vocab;params.wait_text="\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442\u0441\u044f \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u0432";var is_trade=Application.models.Procedure.isStatusExists(lotData.procedure_type, Application.models.Procedure.statuses.trade);performRPCCall(RPC.Protocol.getProtocolsByLot,[{lot_id:component.lot_id}],params,function(resp){this.removeAll();this.add({xtype:"Application.components.lotDataFieldSet",shortInfo:true,cls:"subpanel",style:"padding-bottom: 12px",autoHeight:true,listeners:{afterrender:function(){this.fireEvent("lotloaded",lotData)}}});if(isAdmin())this.add({xtype:"fieldset",title:"\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u0438",cls:"subpanel",style:"padding-bottom: 12px", autoHeight:true,buttonAlign:"left",buttons:[{text:"\u041f\u0435\u0440\u0435\u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044f \u0437\u0430\u044f\u0432\u043e\u043a",disabled:lotData.lot.status<=Application.models.Procedure.statuses.first_parts,handler:function(){component.resendProtocol(lotData.lot.id,"first_parts")}},{text:"\u041f\u0435\u0440\u0435\u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0442\u043e\u0440\u0433\u043e\u0432", disabled:lotData.lot.status<=Application.models.Procedure.statuses.trade||!is_trade,handler:function(){component.resendProtocol(lotData.lot.id,"trade")}},{text:"\u041f\u0435\u0440\u0435\u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0438\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b",disabled:lotData.lot.status-1)cols.push({header:"\u0414\u043e\u0441\u0442\u0443\u043f \u043a \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430\u043c \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u0430",width:40,xtype:"checkcolumn", dataIndex:"is_own_procedures_visible",listeners:{checkchange:function(row,value){var record=component.getStore().getAt(row);performRPCCall(RPC.Company.changeRepresentOption,[{id:record.get("id"),option:"is_own_procedures_visible",value:!value}],[],function(resp){echoResponseMessage(resp);if(!resp.success)component.getStore().reload()})}}});cols.push({header:"\u0421\u0442\u0430\u0442\u0443\u0441",width:40,dataIndex:"status",renderer:function(value,metaData,record){var statuses={1:"\u041d\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0430", 2:"\u041e\u0442\u043e\u0437\u0432\u0430\u043d\u0430",3:"\u041f\u0440\u0438\u043d\u044f\u0442\u0430",4:"\u041e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0430",5:"\u041b\u0438\u0448\u0435\u043d \u043f\u0440\u0430\u0432\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430"};return statuses[record.data.status]},scope:this},{xtype:"textactioncolumn",actionsSeparator:" ",header:"\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u0438",width:40,dataIndex:"id", sortable:false,items:[{icon:"/ico/delete.png",tooltip:"\u041e\u0442\u043e\u0437\u0432\u0430\u0442\u044c",isHidden:function(value,metaData,record){return record.data.status=="2"||record.data.status=="4"},handler:function(grid,rowIndex){var store=grid.getStore();var record=store.getAt(rowIndex);this.fireEvent("cancel",record.id);return false}}],scope:this});return cols},initComponent:function(){var component=this;var store=createRepresentedRightsStore(component.requests);Ext.apply(this,{store:store, columns:component.getColumnsList(),viewConfig:{forceFit:true,markDirty:false},sm:new Ext.grid.RowSelectionModel({singleSelect:true}),loadMask:true,bbar:renderPagingToolbar("\u041e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438",store),listeners:{cancel:function(id){var title="\u041e\u0442\u043c\u0435\u043d\u0430 \u0437\u0430\u044f\u0432\u043a\u0438 \u043d\u0430 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044e \u043f\u043e\u043b\u043d\u043e\u043c\u043e\u0447\u0438\u0439"; var prompt="\u0412\u044b \u0443\u0432\u0435\u0440\u0435\u043d\u044b, \u0447\u0442\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u043e\u0442\u043c\u0435\u043d\u0438\u0442\u044c \u0437\u0430\u044f\u0432\u043a\u0443?";Ext.Msg.show({title:title,msg:prompt,buttons:Ext.Msg.OKCANCEL,fn:function(b){if("ok"==b){var store=component.getStore();component.el.mask("\u041f\u043e\u0434\u043e\u0436\u0434\u0438\u0442\u0435...","x-mask-loading");RPC.Company.acceptRepresentationRequest({"id":id,"status":"cancel"},function(result){component.el.unmask(); if(result.success){Ext.Msg.alert("\u0423\u0441\u043f\u0435\u0448\u043d\u043e","\u0417\u0430\u044f\u0432\u043a\u0430 \u043e\u0442\u043c\u0435\u043d\u0435\u043d\u0430");store.load()}else Ext.Msg.alert("\u041e\u0448\u0438\u0431\u043a\u0430",result.message||"\u041e\u0448\u0438\u0431\u043a\u0430 \u0441\u0432\u044f\u0437\u0438 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c")})}}},this)},render:function(){this.fireEvent("search")},search:function(query,search_params){var store=this.getStore();if(search_params)for(var sp in search_params)store.setBaseParam(sp, search_params[sp]);store.setBaseParam("query",query);store.setBaseParam("type",this.type);store.setBaseParam("start",0);store.setBaseParam("limit",50);store.load()}}});Application.components.RepresentedRightsGrid.superclass.initComponent.call(this)}});Application.components.RepresentationRightsGrid=Ext.extend(Ext.grid.GridPanel,{frame:false,border:false,initComponent:function(){var component=this;var store=createRepresentationRightsStore(component.requests);Ext.apply(this,{store:store,columns:[{id:"id",dataIndex:"id",hidden:true},{id:"representative_id",dataIndex:"representative_id",hidden:true},{xtype:"textactioncolumn",header:"\u041e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044f",dataIndex:"full_name",width:300,items:[{text:function(value, metaData,record){return record.data.full_name},href:function(value,metaData,record){return href_to("company/view/id/"+record.data.representative_id)}}]},{header:"\u0414\u0430\u0442\u0430 \u043f\u043e\u0434\u0430\u0447\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430",width:90,dataIndex:"date",scope:this},{header:"\u0414\u0430\u0442\u0430 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430",width:90,dataIndex:"date_resolved"},{header:"\u0421\u0440\u043e\u043a \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f", width:90,dataIndex:"valid_for",scope:this},{header:"\u0421\u0442\u0430\u0442\u0443\u0441",width:90,dataIndex:"status",renderer:function(value,metaData,record){var statuses={1:"\u041d\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0430",2:"\u041e\u0442\u043e\u0437\u0432\u0430\u043d\u0430",3:"\u041f\u0440\u0438\u043d\u044f\u0442\u0430",4:"\u041e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0430",5:"\u041b\u0438\u0448\u0435\u043d \u043f\u0440\u0430\u0432\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430"}; return statuses[record.data.status]},scope:this},{xtype:"textactioncolumn",header:"\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u0438",actionsSeparator:" ",width:90,dataIndex:"id",sortable:false,items:[{icon:"/ico/accept.png",tooltip:"\u041f\u0440\u0438\u043d\u044f\u0442\u044c",isHidden:function(value,metaData,record){return record.data.status!="1"},handler:function(grid,rowIndex){var store=grid.getStore();var record=store.getAt(rowIndex);this.fireEvent("accept",record.id);return false}},{icon:"/ico/light.png", tooltip:"\u041e\u0442\u043a\u043b\u043e\u043d\u0438\u0442\u044c",isHidden:function(value,metaData,record){return record.data.status!="1"},handler:function(grid,rowIndex){var store=grid.getStore();var record=store.getAt(rowIndex);this.fireEvent("decline",record.id);return false}},{icon:"/ico/block.png",tooltip:"\u041b\u0438\u0448\u0438\u0442\u044c \u043f\u0440\u0430\u0432\u0430",isHidden:function(value,metaData,record){return record.data.status!="3"},handler:function(grid,rowIndex){var store=grid.getStore(); var record=store.getAt(rowIndex);this.fireEvent("deprive",record.id);return false}}],scope:this}],viewConfig:{forceFit:true},sm:new Ext.grid.RowSelectionModel({singleSelect:true}),loadMask:true,bbar:renderPagingToolbar("\u041e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438",store),listeners:{accept:function(id){var title="\u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u0437\u0430\u044f\u0432\u043a\u0438 \u043d\u0430 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044e \u043f\u043e\u043b\u043d\u043e\u043c\u043e\u0447\u0438\u0439"; var prompt="\u0412\u044b \u0443\u0432\u0435\u0440\u0435\u043d\u044b, \u0447\u0442\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044c \u0437\u0430\u044f\u0432\u043a\u0443?";Ext.Msg.show({title:title,msg:prompt,buttons:Ext.Msg.OKCANCEL,fn:function(b){if("ok"==b){var status="accept";var store=component.getStore();component.el.mask("\u041f\u043e\u0434\u043e\u0436\u0434\u0438\u0442\u0435...","x-mask-loading");RPC.Company.acceptRepresentationRequest({"id":id, "status":status},function(result){component.el.unmask();if(result.success){Ext.Msg.alert("\u0423\u0441\u043f\u0435\u0448\u043d\u043e","\u0417\u0430\u044f\u0432\u043a\u0430 \u043f\u0440\u0438\u043d\u044f\u0442\u0430");store.load()}else Ext.Msg.alert("\u041e\u0448\u0438\u0431\u043a\u0430",result.message||"\u041e\u0448\u0438\u0431\u043a\u0430 \u0441\u0432\u044f\u0437\u0438 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c")})}}},this)},decline:function(id){var title="\u041e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u044f\u0432\u043a\u0438 \u043d\u0430 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044e \u043f\u043e\u043b\u043d\u043e\u043c\u043e\u0447\u0438\u0439"; var prompt="\u0412\u044b \u0443\u0432\u0435\u0440\u0435\u043d\u044b, \u0447\u0442\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u043e\u0442\u043a\u043b\u043e\u043d\u0438\u0442\u044c \u0437\u0430\u044f\u0432\u043a\u0443?";Ext.Msg.show({title:title,msg:prompt,buttons:Ext.Msg.OKCANCEL,fn:function(b){if("ok"==b){var status="decline";var store=component.getStore();component.el.mask("\u041f\u043e\u0434\u043e\u0436\u0434\u0438\u0442\u0435...","x-mask-loading");RPC.Company.acceptRepresentationRequest({"id":id, "status":status},function(result){component.el.unmask();if(result.success){Ext.Msg.alert("\u0423\u0441\u043f\u0435\u0448\u043d\u043e","\u0417\u0430\u044f\u0432\u043a\u0430 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0430");store.load()}else Ext.Msg.alert("\u041e\u0448\u0438\u0431\u043a\u0430",result.message||"\u041e\u0448\u0438\u0431\u043a\u0430 \u0441\u0432\u044f\u0437\u0438 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c")})}}},this)},deprive:function(id){var title="\u041b\u0438\u0448\u0435\u043d\u0438\u0435 \u043f\u0440\u0430\u0432 \u043d\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440"; var prompt="\u0412\u044b \u0443\u0432\u0435\u0440\u0435\u043d\u044b, \u0447\u0442\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u043b\u0438\u0448\u0438\u0442\u044c \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u043f\u0440\u0430\u0432\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440?";Ext.Msg.show({title:title,msg:prompt,buttons:Ext.Msg.OKCANCEL,fn:function(b){if("ok"==b){var status="deprive";var store=component.getStore(); component.el.mask("\u041f\u043e\u0434\u043e\u0436\u0434\u0438\u0442\u0435...","x-mask-loading");RPC.Company.acceptRepresentationRequest({"id":id,"status":status},function(result){component.el.unmask();if(result.success){Ext.Msg.alert("\u0423\u0441\u043f\u0435\u0448\u043d\u043e","\u0414\u0430\u043d\u043d\u044b\u0439 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0442\u043e\u0440 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u043f\u0440\u0430\u0432 \u043d\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440"); store.load()}else Ext.Msg.alert("\u041e\u0448\u0438\u0431\u043a\u0430",result.message||"\u041e\u0448\u0438\u0431\u043a\u0430 \u0441\u0432\u044f\u0437\u0438 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c")})}}},this)},render:function(){this.fireEvent("search")},search:function(query,search_params){var store=this.getStore();if(search_params)for(var sp in search_params)store.setBaseParam(sp,search_params[sp]);store.setBaseParam("query",query);store.setBaseParam("type",this.type);store.setBaseParam("start", 0);store.setBaseParam("limit",50);store.load()}}});Application.components.RepresentationRightsGrid.superclass.initComponent.call(this)}});Ext.define("Application.components.ExplainView",{extend:"Ext.form.Panel",frame:true,border:false,initComponent:function(){var component=this;var request_info_panel=Ext.id();function loadRequestData(){var i,n;RPC.Procedure.loadExplain(component.lot,component.request,function(result){if(result.success){if(result.request&&result.request.request_id!==null){var requestData=result.request;if(result.files_response&&result.files_response.length>0&&requestData.status!=4){var files_response=[];for(i=0,n=result.files_response.length;i< n;++i)files_response.push(i+1+") "+getFileDownloadTemplate().apply(result.files_response[i]["html"][0]));requestData=Ext.apply({response_docs:files_response.join("
      ")},requestData)}Ext.getCmp(request_info_panel).update(getExplainInfoTemplate().apply(requestData));component.setTitle("\u0420\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043a \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435 "+result.request.procedure_registry_number+ ", \u043b\u043e\u0442 \u2116"+result.request.lot_number)}}else Ext.Msg.alert("\u041e\u0448\u0438\u0431\u043a\u0430",result.message)})}Ext.apply(this,{title:component.title,bodyCssClass:"subpanel-top-padding",defaults:{xtype:"fieldset",autoHeight:true},items:[{id:request_info_panel}],buttons:[{text:"\u041d\u0430\u0437\u0430\u0434",handler:function(){history.back(1)}}],listeners:{afterrender:function(){loadRequestData()}}});Application.components.ExplainView.superclass.initComponent.call(this)}});Ext.define("Application.components.RequestDashboard",{extend:"Ext.Panel",initComponent:function(){var component=this;Ext.apply(component,{layout:"border",items:[{region:"west",title:"\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0442\u0438\u043f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432",xtype:"Application.components.RequestNavigationTree",width:350,hidden:!!component.hideNavigation},{region:"center",xtype:"Application.components.RequestTabPanel",requestGridParams:component.requestGridParams|| false,filter_query:component.filter_query||false,activeTab:component.activetab,supplier:component.supplier}]});Application.components.RequestDashboard.superclass.initComponent.call(this)}});Ext.define("Application.components.RequestForm",{extend:"Ext.form.Panel",frame:true,fileUpload:true,requestFiles:false,initComponent:function(){var component=this,filePanelId=Ext.id(),procedure_info_panel=Ext.id(),request_fieldset_id=Ext.id(),coordination_panel_id=Ext.id(),request_textarea_id=Ext.id(),send_to_oos=false,message_name_title="\u0422\u0435\u043a\u0441\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u0430";if(!component.application_id)component.application_id=null;if(component.message_name== "response_message")message_name_title="\u0422\u0435\u043a\u0441\u0442 \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f";else if(component.message_name=="cancel_reason")message_name_title="\u041f\u0440\u0438\u0447\u0438\u043d\u0430 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f";function isFormValid(){var filePanelCmp=Ext.getCmp(filePanelId);var has_files=false;if(filePanelCmp)var has_files=Ext.getCmp(filePanelId).items.get(0).isFileAttached();var valid=component.getForm().isValid(); if(!valid){alertError("\u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u0437\u0430\u043f\u043e\u043b\u0438\u0442\u0435 \u0444\u043e\u0440\u043c\u0443 \u043f\u043e\u0434\u0430\u0447\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430");return false}if(!has_files&&!!component.requestFiles){alertError("\u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u043f\u0440\u0438\u043a\u0440\u0435\u043f\u0438\u0442\u0435 \u0444\u0430\u0439\u043b\u044b \u043a \u0444\u043e\u0440\u043c\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430"); return false}return true}function textLenValidate(){var req_text=Ext.getCmp(request_textarea_id).getValue();if(req_text.length>2E3&&send_to_oos){alertError("\u0412 \u0441\u0432\u044f\u0437\u0438 \u0441 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f\u043c\u0438 \u043a \u0444\u043e\u0440\u043c\u0430\u0442\u0430\u043c \u0438 \u0444\u0430\u0439\u043b\u0430\u043c \u0415\u0418\u0421, \u0434\u043b\u0438\u043d\u0430 \u0442\u0435\u043a\u0441\u0442\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438 \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0430 \u043d\u0435\u0433\u043e \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0442\u044c 2000 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432. \u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u043e\u0442\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0439\u0442\u0435 \u0442\u0435\u043a\u0441\u0442 \u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u0435 \u043f\u043e\u043f\u044b\u0442\u043a\u0443."); return false}else return true}component.delete_files=function(file,cmp){temp_panel=Ext.getCmp("files_uploaded_"+(file.req_id||""));temp_comp=cmp;component.rpc_remove_request_file(file,function(result){if(result.success)temp_panel.remove(temp_comp);else Ext.Msg.alert("\u041e\u0448\u0438\u0431\u043a\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u0430",result.message)})};function loadRequestData(){if(!component.disableFilePanel){var doc_panel=Ext.getCmp(request_fieldset_id); doc_panel.add({id:filePanelId,border:false,hideTitle:true,items:[{xtype:"Application.components.FilesPanel",file_panels:[{name:"\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b"+(component.requestFiles?REQUIRED_FIELD:""),withDescr:false}],is_panel:true}]});doc_panel.doLayout()}component.rpc_load_request(component.lot_id,component.rpc_load_request_type,component.getForm().findField("request_id").getValue(),component.application_id,component.request_type,component.message_type,!!component.personal, function(result){if(!!result&&!!result.success){var isDocResponse="doc"===component.rpc_load_request_type&&"response"===component.request_type,found=!!result.request&&result.request.request_id!==null,personalDiffs=!!result.request&&null!==result.request.personal&&!!result.request.personal!==!!component.personal;if(isDocResponse&&found&&personalDiffs){var location="com/procedure/request/type/response/"+"procedure/"+component.procedure_id+"/lot/"+component.lot_id+"/reqid/"+result.request.request_id; if(!!result.request.personal)location+="/personal/1";redirect_to(location);return}if(found){var requestData=result.request;component.getForm().setValues(requestData);component.getForm().findField("personal").setValue(!!component.personal?"1":"0");if(Main.config.procedure_coordination&&component.request_type=="response"&&component.rpc_load_request_type=="doc")setComponentValues(Ext.getCmp(coordination_panel_id),requestData);if(!component.disableFilePanel)loadFilesIntoFilePanels(component.request_type== "request"?result.files_request:result.files_response,{deleteHandler:component.delete_files})}}else Ext.Msg.alert("\u041e\u0448\u0438\u0431\u043a\u0430",result.message)})}this.addEvents("reload");Ext.apply(this,{frame:true,title:component.title,defaults:{xtype:"fieldset",autoHeight:true},items:[{id:procedure_info_panel,title:"\u0421\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435",style:"margin: 5px",hidden:component.rpc_load_request_type=="application"? true:false},{id:request_fieldset_id,title:component.textareaFieldTitle,layout:"form",labelWidth:200,style:"margin: 5px 5px 0 5px",items:[{xtype:"label",fieldLabel:message_name_title+""+(component.request_type=="request"?REQUIRED_FIELD:"")},{xtype:"textarea",anchor:"100%",height:150,id:request_textarea_id,name:component.message_name,hideLabel:true,allowBlank:false,processValue:function(val){return val.trim()},blankText:"\u0421\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0431\u0435\u0437 \u0442\u0435\u043a\u0441\u0442\u0430 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e"}, {xtype:"Application.components.dateField",fieldLabel:"\u0414\u0430\u0442\u0430 \u043f\u0440\u0438\u043d\u044f\u0442\u0438\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f"+REQUIRED_FIELD,allowBlank:false,format:"d.m.Y",altFormats:"c|d.m.Y H:i:s|d.m.Y H:i",anchor:null,hidden:component.rpc_load_request_type=="application"||component.request_type!="response"?true:false,disabled:component.rpc_load_request_type=="application"||component.request_type!="response"?true:false,name:"date_decision",width:200}]}, {xtype:"Application.components.ProcedureCoordination",title:"\u0421\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u0438\u0435 \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f",id:coordination_panel_id,parent:component,hidden:!Main.config.procedure_coordination||component.request_type!="response"||component.rpc_load_request_type!="doc"},{xtype:"hidden",name:"lot_id",value:component.lot_id},{xtype:"hidden",name:"procedure_id",value:component.procedure_id},{xtype:"hidden",name:"application_id", value:component.application_id},{xtype:"hidden",name:"request_id",value:component.request_id},{xtype:"hidden",name:"message_type",value:component.message_type},{xtype:"hidden",name:"request_type",value:component.request_type},{xtype:"hidden",name:"personal",value:!!component.personal?"1":"0"}],buttons:[{text:"\u041d\u0430\u0437\u0430\u0434",handler:function(){history.back(1)}},{text:"\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c",scope:this,formBind:true,handler:function(){var form=this; if(!textLenValidate())return false;var form=this;if(isFormValid())performSave(form,null,"reload");else alertError("\u041e\u0448\u0438\u0431\u043a\u0430 \u0432 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u043f\u043e\u043b\u0435\u0439")}},{text:"\u041f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c \u0438 \u043d\u0430\u043f\u0440\u0430\u0432\u0438\u0442\u044c",formBind:true,scope:this,handler:function(){if(!textLenValidate())return false;if(isFormValid())if(component.request_type== "request"){var url;if(!component.application_id)url="com/procedure/"+component.sign_action+"/type/request/lot/"+component.lot_id+"/procedure/"+component.procedure_id;else url="com/procedure/"+component.sign_action+"/type/request/lot/"+component.lot_id+"/application/"+component.application_id+"/procedure/"+component.procedure_id;url=component.message_type!=undefined?url+"/message_type/"+component.message_type:url;performSave(this,url,undefined,false,false)}else if(component.request_type=="response")performSave(this, "com/procedure/"+component.sign_action+"/type/response/reqid/"+component.getForm().findField("request_id").getValue()+"/procedure/"+component.procedure_id,undefined,false,false);else{if(component.request_type=="cancel")performSave(this,"com/procedure/"+component.sign_action+"/type/cancel/reqid/"+component.getForm().findField("request_id").getValue()+"/procedure/"+component.procedure_id,undefined,false,false)}else alertError("\u041e\u0448\u0438\u0431\u043a\u0430 \u0432 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u043f\u043e\u043b\u0435\u0439")}}], listeners:{afterrender:function(){var params={mask:true,mask_el:this.getEl()};if(component.procedure_id>0&&component.request_type=="response"){component.requestFiles=true;if(component.original_message_type||component.personal)component.requestFiles=false}performRPCCall(RPC.Procedure.load,[component.procedure_id],params,function(resp){if(resp&&resp.success){if(component.rpc_load_request_type=="application"){if(!(resp.procedure.application_stages==2&&[Application.models.Procedure.type_ids.auction_up, Application.models.Procedure.type_ids.auction_down,Application.models.Procedure.type_ids.contest].indexOf(resp.procedure.procedure_type)>-1)&&!(resp.procedure.application_stages==1&&resp.procedure.procedure_type==Application.models.Procedure.type_ids.auction_up_26))performRPCCall(RPC.Company.suppliershortview,[{applic_id:component.application_id}],params,function(resp){if(resp&&resp.success){component.insert(0,{xtype:"Application.components.cmpDataView",noneditable:true,cmpData:resp.cmp});component.doLayout()}else echoResponseMessage(resp)})}else{component.procedure_organizer_department_id= resp.procedure.organizer_department_id;Ext.getCmp(procedure_info_panel).update(getProcedureDataTemplate().apply(resp.procedure))}send_to_oos=resp.procedure.send_to_oos;component.getForm().setValues(resp.procedure);loadRequestData()}else if(resp)echoResponseMessage(resp)})},reload:function(){var doc_panel=Ext.getCmp(request_fieldset_id);doc_panel.remove(Ext.getCmp(filePanelId));filePanelId=Ext.id();loadRequestData()}}});Application.components.RequestForm.superclass.initComponent.call(this);this.form.api= {submit:component.submit_fn};this.form.waitMsgTarget=true}});Ext.define("Application.components.RequestGrid",{extend:"Ext.grid.Panel",frame:true,border:false,typeParams:false,getRpcMethod:function(){return this.typeParams[this.type]["rpc"]?this.typeParams[this.type]["rpc"]:false},getRequestAction:function(data){return this.getTypeByRowType(data.request_type)},getShowrequestAction:function(data){return"show"+this.getTypeByRowType(data.request_type)},getApplicationAction:function(data){return this.getTypeByRowType(data.request_type)=="requestapplic"?"/application/{application_id}": ""},getTypeByRowType:function(row_type){switch(row_type){case "applic_explain_requests":return"requestapplic";break;case "doc_explain_requests":return"request";break;case "result_explain_requests":return"requestresult";break}},initComponent:function(){var component=this;var baseParams={};var store_fields=["id",{name:"date_added",type:"date",dateFormat:"c"},{name:"date_forwarded",type:"date",dateFormat:"c"},"status_id","status_name","lot_id","number","lot_title","lot_status","registry_number","procedure_id", "proc_title","request_message","organizer_contragent_id","customer_id",{name:"date_solved",type:"date",dateFormat:"c"},{name:"date_cancelled",type:"date",dateFormat:"c"},"type","request_type","application_id","customer_extra_rights"];component.typeParams=component.typeParams||{all:{rpc:RPC.Procedure.allrequestslist},request:{rpc:RPC.Procedure.requestlist},requestresult:{rpc:RPC.Procedure.requestresultlist},requestapplic:{rpc:RPC.Procedure.requestappliclist}};var showSupplierNameField="requestapplic"== component.type&&isCustomer();store_fields.push("supplier_name");if(component.optype&&["allrequest","request","response","rejected"].indexOf(component.optype)>-1){Ext.apply(baseParams,{request_status:component.optype});if(component.message_type)Ext.apply(baseParams,{message_type:component.message_type})}var store=new Ext.data.DirectStore({autoDestroy:true,directFn:component.getRpcMethod(),totalProperty:"totalCount",root:"rows",sortInfo:{field:"date_forwarded",direction:"DESC"},remoteSort:true,autoLoad:false, baseParams:baseParams,fields:store_fields});var requesttype_renderer=function(value,metaData,record,rowIndex,colIndex,store){var icon,tooltip;switch(record.data.request_type){case "doc_explain_requests":icon="/ico/applics/request.png";tooltip="\u0420\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438";break;case "result_explain_requests":switch(record.data.type){case 1:icon="/ico/message.png";tooltip="\u0420\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f \u0438\u0442\u043e\u0433\u043e\u0432 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440"; break;case 2:icon="/ico/message5.png";tooltip="\u0420\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f \u0438\u0442\u043e\u0433\u043e\u0432 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u0442\u0431\u043e\u0440\u0430";break;case 3:icon="/ico/message4.png";tooltip="\u0420\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u043a\u0443\u0440\u0441\u043d\u044b\u0445 \u0437\u0430\u044f\u0432\u043e\u043a"; break}break}this.items[0].icon=icon;this.items[0].tooltip=tooltip;return false};var status_name_renderer=function(val){return val=="\u0412 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0438 \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f"?''+val+"":val};Ext.apply(this,{loadMask:true,store:store,viewConfig:{forceFit:true},columns:[{header:"#",xtype:"actioncolumn",align:"left",hidden:component.type!="all",renderer:requesttype_renderer,dataIndex:"type", sortable:false,width:8},{header:"\u0420\u0435\u0435\u0441\u0442\u0440\u043e\u0432\u044b\u0439 \u2116",dataIndex:"registry_number",width:40,sortable:true},{header:"\u0414\u0430\u0442\u0430 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f",dataIndex:"date_forwarded",sortable:true,width:40,renderer:Ext.util.Format.dateRenderer("d.m.Y H:i")},{header:"\u0414\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043c\u044f \u043e\u0442\u0432\u0435\u0442\u0430",dataIndex:"date_solved",hidden:component.optype!= "response",sortable:true,width:30,renderer:Ext.util.Format.dateRenderer("d.m.Y H:i")},{header:"\u0414\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043c\u044f \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f",dataIndex:"date_cancelled",hidden:component.optype!="rejected",sortable:true,width:30,renderer:Ext.util.Format.dateRenderer("d.m.Y H:i")},{header:"\u041d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b",dataIndex:"proc_title", sortable:true},{header:"\u041d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430",dataIndex:"supplier_name",hidden:!showSupplierNameField,sortable:true},{header:"\u0421\u0442\u0430\u0442\u0443\u0441",dataIndex:"status_name",sortable:true,width:30,renderer:status_name_renderer},{header:"\u041a\u0440\u0430\u0442\u043a\u043e\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430", dataIndex:"request_message",sortable:false},{header:"\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u0438",dataIndex:"extra",sortable:false,width:30,xtype:"textactioncolumn",actionsSeparator:" ",items:[{tooltip:"\u0422\u0435\u043a\u0441\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u0430",icon:"/ico/settings/browse.png",isShown:function(v,m,r){return r.data.status_id==3||r.data.status_id==2},handler:function(grid,rowIndex,colIndex,item,e){var data=component.getAt(rowIndex);redirectActionHandler("com/procedure/"+ component.getShowrequestAction(data.data)+"/procedure/{procedure_id}/lot/{lot_id}/reqid/{id}/message_type/{type}"+component.getApplicationAction(data.data))(grid,rowIndex)}},{tooltip:"\u0422\u0435\u043a\u0441\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438 \u043f\u0440\u0438\u0447\u0438\u043d\u0430 \u0435\u0433\u043e \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f",icon:"/ico/settings/browse.png",isShown:function(v,m,r){return r.data.status_id==4},handler:function(grid,rowIndex, colIndex,item,e){var data=component.getAt(rowIndex);redirectActionHandler("com/procedure/"+component.getShowrequestAction(data.data)+"/procedure/{procedure_id}/lot/{lot_id}/reqid/{id}/message_type/{type}"+component.getApplicationAction(data.data)+"/message_type/{type}")(grid,rowIndex)}},{tooltip:"\u041e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435",icon:"/ico/settings/change_data.png",isShown:function(v,m,r){if(!component.getApplicationAction(r.data))return isCustomer()&& r.data.status_id==2&&Main.user.contragent_id==r.data.organizer_contragent_id&&r.data.lot_status<=8;else return isSupplier()&&r.data.status_id==2&&Main.user.contragent_id!=r.data.organizer_contragent_id&&r.data.lot_status<=8},handler:function(grid,rowIndex,colIndex,item,e){var data=component.getAt(rowIndex);redirectActionHandler("com/procedure/"+component.getRequestAction(data.data)+"/type/response/procedure/{procedure_id}/lot/{lot_id}/reqid/{id}/message_type/{type}"+component.getApplicationAction(data.data))(grid, rowIndex)}},{tooltip:"\u0418\u043d\u0434\u0438\u0432\u0438\u0434\u0443\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435",icon:"/ico/settings/browse_warrant.png",isShown:function(v,m,r){if(!component.getApplicationAction(r.data))return isCustomer()&&r.data.status_id==2&&Main.user.contragent_id==r.data.organizer_contragent_id&&r.data.lot_status<=8;else return false},handler:function(grid,rowIndex,colIndex,item,e){var data=component.getAt(rowIndex); redirectActionHandler("com/procedure/"+component.getRequestAction(data.data)+"/type/response/procedure/{procedure_id}/lot/{lot_id}/reqid/{id}/personal/1/message_type/{type}"+component.getApplicationAction(data.data))(grid,rowIndex)}},{tooltip:"\u041e\u0442\u043a\u043b\u043e\u043d\u0438\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441",icon:"/ico/delete.png",isShown:function(v,m,r){if(!component.getApplicationAction(r.data))return isCustomer()&&r.data.status_id==2&&Main.user.contragent_id==r.data.organizer_contragent_id; else return isSupplier()&&r.data.status_id==2&&Main.user.contragent_id!=r.data.organizer_contragent_id},handler:function(grid,rowIndex,colIndex,item,e){var data=component.getAt(rowIndex);redirectActionHandler("com/procedure/"+component.getRequestAction(data.data)+"/type/cancel/procedure/{procedure_id}/lot/{lot_id}/reqid/{id}/message_type/{type}"+component.getApplicationAction(data.data))(grid,rowIndex)}}]}],tbar:{xtype:"Application.components.searchToolbar",searchHelp:"\u041d\u043e\u043c\u0435\u0440 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b", eventTarget:this,advancedSearchDefaults:{statePrefix:"request_grid_search",stateSuffix:this.filter},advancedSearch:[{xtype:"checkbox",name:"archive_lots",labelWidth:400,boxLabel:"",fieldLabel:"\u041f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0430\u0440\u0445\u0438\u0432\u043d\u044b\u0435 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b",labelSeparator:":"}]},bbar:renderPagingToolbar("\u0417\u0430\u043f\u0440\u043e\u0441\u044b",store),listeners:{render:function(){},show:function(){component.getTopToolbar().setValues({query:component.parent.filter_query}); component.getTopToolbar().doSearch()},search:function(query,aq){component.parent.fireEvent("searchFilter",query,component);if(query)query=query.toLowerCase();aq=aq||{};aq.registry_number=query;if(aq)for(var sp in aq)store.setBaseParam(sp,aq[sp]);store.load()}},getAt:function(rowIndex){return this.getStore().getAt(rowIndex)}});Application.components.RequestGrid.superclass.initComponent.call(this)}});Ext.define("Application.components.RequestNavigationTree",{extend:"Ext.tree.TreePanel",initComponent:function(){var component=this;Ext.apply(component,{autoScroll:true,split:true,loader:new Ext.tree.TreeLoader,root:new Ext.tree.AsyncTreeNode({expanded:true,children:[{text:"\u0412\u0441\u0435 \u0442\u0438\u043f\u044b",url:"com/procedure/requests",leaf:true},{text:"\u0420\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043a \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430\u043c", url:"com/procedure/requestlist",icon:"/ico/applics/request.png",leaf:true},{text:"\u0420\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f \u0438\u0442\u043e\u0433\u043e\u0432 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440",url:"com/procedure/requestresultlist/message_type/1",icon:"/ico/message.png",leaf:true},{text:"\u0420\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f \u0438\u0442\u043e\u0433\u043e\u0432 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u0442\u0431\u043e\u0440\u0430", url:"com/procedure/requestresultlist/message_type/2",icon:"/ico/message5.png",leaf:true},{text:"\u0420\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u043a\u0443\u0440\u0441\u043d\u044b\u0445 \u0437\u0430\u044f\u0432\u043e\u043a",url:"com/procedure/requestresultlist/message_type/3",icon:"/ico/message4.png",leaf:true}]}),rootVisible:false, listeners:{click:function(n){redirect_to(n.attributes.url)},afterrender:function(cmp){var location=Main.app.getCurrentLocation();cmp.getRootNode().findChildBy(function(node){if(node.attributes.url&&location.indexOf(node.attributes.url)>-1)node.select()})}}});Application.components.RequestNavigationTree.superclass.initComponent.call(this)}});Ext.define("Application.components.RequestView",{extend:"Ext.form.Panel",frame:true,cls:"spaced-panel",fileUpload:true,initComponent:function(){var component=this;var procedure_info_panel=Ext.id();var request_info_panel=Ext.id();function loadRequestData(){component.rpc_load_request(component.lot,component.rpc_load_request_type,component.request,component.application_id,null,null,null,function(result){if(result.success){if(result.request&&result.request.request_id!==null){var requestData=result.request; if(result.files_request&&result.files_request.length>0){var files_request=[];for(var i=0,n=result.files_request.length;i")},requestData)}if(result.files_response&&result.files_response.length>0&&requestData.status!=4){var files_response=[];for(i=0,n=result.files_response.length;i")},requestData)}var request_info_panel_cmp=Ext.getCmp(request_info_panel);if(requestData.status==2)request_info_panel_cmp.setTitle("\u0422\u0435\u043a\u0441\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u0430");else if(requestData.status==3)request_info_panel_cmp.setTitle("\u0422\u0435\u043a\u0441\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438 \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f");else if(requestData.status== 4)request_info_panel_cmp.setTitle("\u0422\u0435\u043a\u0441\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438 \u043f\u0440\u0438\u0447\u0438\u043d\u044b \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f");Ext.getCmp(request_info_panel).update(getRequestInfoTemplate().apply(requestData))}}else Ext.Msg.alert("\u041e\u0448\u0438\u0431\u043a\u0430",result.message)})}Ext.apply(this,{frame:true,title:component.title,cls:"spaced-panel",defaults:{xtype:"fieldset",autoHeight:true},items:[{id:procedure_info_panel, title:"\u0421\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435"},{id:request_info_panel,title:"\u0422\u0435\u043a\u0441\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438 \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f"}],buttons:[{text:"\u041d\u0430\u0437\u0430\u0434",handler:function(){history.back(1)}}],listeners:{afterrender:function(){var params={mask:true,mask_el:this.getEl()};performRPCCall(RPC.Procedure.load,[component.procedure], params,function(resp){if(resp&&resp.success){Ext.getCmp(procedure_info_panel).update(getProcedureDataTemplate().apply(resp.procedure));component.getForm().setValues(resp.procedure)}else if(resp)echoResponseMessage(resp)});loadRequestData()}}});Application.components.RequestView.superclass.initComponent.call(this);this.form.api={submit:component.submit_fn};this.form.waitMsgTarget=true}});Ext.define("Application.components.RequestTabPanel",{extend:"Ext.TabPanel",filter_query:false,initComponent:function(){var component=this;var AllRequestPanel={xtype:"Application.components.RequestGrid",parent:component,title:"\u0417\u0430\u043f\u0440\u043e\u0441\u044b \u043d\u0430 \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435",optype:"allrequest",closable:false};var RequestPanel={xtype:"Application.components.RequestGrid",parent:component,title:"\u041d\u0435\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b", optype:"request",closable:false};var ResponsePanel={xtype:"Application.components.RequestGrid",parent:component,title:"\u041e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u044b",optype:"response",closable:false};var RejectPanel={xtype:"Application.components.RequestGrid",parent:component,title:"\u041e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b",optype:"rejected",closable:false};component.addEvents(["searchFilter"]); Ext.apply(RequestPanel,component.requestGridParams);Ext.apply(ResponsePanel,component.requestGridParams);Ext.apply(RejectPanel,component.requestGridParams);Ext.apply(AllRequestPanel,component.requestGridParams);var activeTab=parseInt(component.activeTab);if(isNaN(activeTab))activeTab=0;Ext.apply(this,{activeTab:activeTab,enableTabScroll:false,border:false,items:[AllRequestPanel,RequestPanel,ResponsePanel,RejectPanel],listeners:{searchFilter:function(query,sender){component.filter_query=query;component.items.each(function(item){if(item.xtype== "Application.components.RequestGrid"){if(sender==item)return;item.getTopToolbar().setValues({query:query})}})}}});Application.components.RequestTabPanel.superclass.initComponent.call(this)}});Ext.define("Application.components.ContractDocumentsFormPanel",{extend:"Ext.form.FormPanel",labelWidth:200,frame:true,border:false,buttonAlign:"left",monitorValid:true,lot_id:null,supplier_id:null,values:{},procedure:{},getSupplierInfoPanel:function(contragentData,additionalPanels){return{xtype:"container",ref:"supplierInfoPanelCmp",items:[{xtype:"Application.components.cmpDataViewExt",cmpData:contragentData},additionalPanels]}},getAdditionalSuppliersInfoPanel:function(suppliers){var items=[];Ext.iterate(suppliers, function(supplierInfo){items.push({xtype:"Application.components.cmpDataViewExt",cmpData:supplierInfo["supplier"]})});return{xtype:"container",ref:"additionalSuppliersPanelCmp",items:items}},getAdditionalSupplierSignaturesPanel:function(suppliers){var items=[];Ext.iterate(suppliers,function(item){items.push({xtype:"panel",style:"padding: 5px 0;",flex:1,html:'"+'
      '+(!!item["date_signed"]?"\u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043e":"\u043e\u0436\u0438\u0434\u0430\u0435\u0442 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u0435")+"
      "+'
      '+(!!item["date_signed"]?Ext.util.Format.date(item["date_signed"]):"")+"
      "})});return{xtype:"fieldset",height:"auto",title:"\u0421\u0442\u0430\u0434\u0438\u044f \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432", items:items}},getDocumentsFieldset:function(files,readonly){var me=this;return{xtype:"fieldset",title:"\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b",minHeight:160,autoHeight:true,items:[{html:UPLOAD_FILES_TITLE+"
      "+ACCEPTED_FILES+".",cls:"spaced-bottom-shallow",autoHeight:true,hidden:readonly},{xtype:"Application.components.multiuploadPanel",allowBlank:false,uploadHandler:RPC.Contractdocuments.addFile,deleteHandler:!readonly?RPC.Contractdocuments.removeFile:false,name:"contract_files", simultaneousUpload:true,autoUpload:true,withDescr:true,hideUploadFields:readonly,files:files,listeners:{beforeupload:function(cmp){cmp.uploadParams.type=LOT_DOCUMENT_TYPE_PROCEDURE_CONTRACT_DOCUMENT;cmp.uploadParams.lot_id=me.lot_id;cmp.uploadParams.contractdocuments_id=me.values.id;cmp.uploadParams.upload_contragent_id=me.supplier_id},uploadcomplete:function(result){me.values.id=result.contractdocuments_id}}}]}},getBeneficiaryDocumentsFieldset:function(files,readonly){var me=this;return{xtype:"fieldset", title:"\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0446\u0435\u043f\u043e\u0447\u043a\u0435 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u0438\u043a\u043e\u0432, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0431\u0435\u043d\u0435\u0444\u0438\u0446\u0438\u0430\u0440\u043e\u0432 (\u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0445)",autoHeight:true,minHeight:160,items:[{html:UPLOAD_FILES_TITLE+"
      "+ACCEPTED_FILES+ ".",cls:"spaced-bottom-shallow",autoHeight:true,hidden:readonly},{html:"\u043d\u0435\u0442 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432",cls:"center-align not-actual",hidden:!readonly||!isEmpty(files)},{xtype:"Application.components.multiuploadPanel",allowBlank:true,uploadHandler:RPC.Contractdocuments.addFile,deleteHandler:!readonly?RPC.Contractdocuments.removeFile:false,name:"contract_beneficiary_files",simultaneousUpload:true,autoUpload:true,withDescr:true,hideUploadFields:readonly, files:files,listeners:{beforeupload:function(cmp){cmp.uploadParams.type=LOT_DOCUMENT_TYPE_PROCEDURE_CONTRACT_DOCUMENT_BENEFICIARY;cmp.uploadParams.contractdocuments_id=me.values.id;cmp.uploadParams.lot_id=me.lot_id;cmp.uploadParams.upload_contragent_id=me.supplier_id},uploadcomplete:function(result){me.values.id=result.contractdocuments_id}}}]}},getFilesPanel:function(files,readonly){var me=this;return{xtype:"container",ref:"documentsPanelCmp",items:[me.getDocumentsFieldset(files["contract_files"], readonly),me.getBeneficiaryDocumentsFieldset(files["contract_beneficiary_files"],readonly)]}},getStatusPanel:function(status,additional_text){additional_text=!isEmpty(additional_text)?"
      \u041a\u043e\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439 \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u0430: "+additional_text:"";return{xtype:"Application.components.InformationFieldset",title:"\u0421\u0442\u0430\u0442\u0443\u0441 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432", padding:10,text:renderStatusIcon(CONTRACT_DOCUMENTS_STATUS_ICON[status])+CONTRACT_DOCUMENTS_STATUS_TEXT[status]+additional_text||"\u041d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 \u0441\u0442\u0430\u0442\u0443\u0441",ref:"statusPanelCmp"}},getLoadingFieldset:function(){return{xtype:"Application.components.LoadingFieldset"}},getSignatureButton:function(){var me=this;return{xtype:"button",text:"\u0420\u0435\u043a\u0432\u0438\u0437\u0438\u0442\u044b "+t("\u042d\u0426\u041f")+" \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044f", handler:function(){var params={contractdocuments_id:me.values.id};performRPCCall(RPC.Contractdocuments.edsinfo,[params],{wait_text:"\u0418\u0434\u0435\u0442 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445"},function(resp){if(resp.success){var edsWin=new Ext.Window({autoHeight:true,width:600,title:"\u0414\u0430\u043d\u043d\u044b\u0435 "+t("\u042d\u0426\u041f"),constrain:true,modal:true,items:[{xtype:"panel",width:"100%",border:false,autoHeight:true,frame:true, bodyCssClass:"subpanel-top-padding",html:Ext.util.Format.nl2br(resp.html)}],buttonAlign:"center",buttons:[{text:"\u0417\u0430\u043a\u0440\u044b\u0442\u044c",handler:function(){edsWin.close()}}]});edsWin.show()}})},listeners:{beforerender:function(){if(me.values.status==CONTRACT_DOCUMENTS_STATUS_DRAFT)this.hidden=true}}}},getDownloadButton:function(){var me=this;return{text:"\u0421\u043a\u0430\u0447\u0430\u0442\u044c \u0432\u0441\u0435 \u0444\u0430\u0439\u043b\u044b",handler:function(){document.location.href= "/contractdocuments/download/lot_id/"+me.lot_id+"/supplier_id/"+me.values.supplier_id}}},getSubmitSignatureText:function(){var component=this;var signDate=Ext.util.Format.localDateRenderer(new Date).replace(" ","");var text="\u041d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u043c \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0417\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u0435\u043c \u041f\u0430\u043a\u0435\u0442\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u043f\u043e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435 #"+ component.procedure.registry_number+', "'+component.procedure.title+'"\n'+"\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c: "+Main.user.full_name+"\n"+"\u0417\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044c: "+Main.contragent.full_name+"\n"+"\u0414\u0430\u0442\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438: "+signDate;return text},getSubmitButton:function(){var me=this;return{text:"\u041d\u0430\u043f\u0440\u0430\u0432\u0438\u0442\u044c",formBind:true,handler:function(cmp){var parameters= {contractdocuments_id:me.values.id,lot_id:me.lot_id,supplier_id:me.supplier_id};var win=new Application.components.promptWindow({title:"\u041f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u0430\u043a\u0435\u0442\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432",modal:true,cmpType:"Application.components.SignatureForm",cmpParams:{api:RPC.Contractdocuments.submit,signatureText:me.getSubmitSignatureText(),signatureTextHeight:250,useFormHandler:false,formItems:parameters, success_fn:function(resp){win.close();echoResponseMessage(resp,function(){Main.app.run()})}}});win.show()},listeners:{beforerender:function(){if(!me.is_additional_supplier&&me.doc_status==CONTRACT_DOCUMENTS_STATUS_WAITING_FOR_SUPPLIERS)this.disabled=true}}}},getAdditionalSubmitButton:function(){var me=this;return{text:"\u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044c",formBind:true,handler:function(cmp){var parameters={contractdocuments_id:me.values.id,lot_id:me.lot_id,supplier_id:me.supplier_id}; var win=new Application.components.promptWindow({title:"\u041f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u0430\u043a\u0435\u0442\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432",modal:true,cmpType:"Application.components.SignatureForm",cmpParams:{api:RPC.Contractdocuments.submit,signatureText:me.getSubmitSignatureText(),signatureTextHeight:250,useFormHandler:false,formItems:parameters,success_fn:function(resp){win.close();echoResponseMessage(resp,function(){Main.app.run()})}}}); win.show()},listeners:{beforerender:function(){if(!me.is_additional_supplier&&me.doc_status==CONTRACT_DOCUMENTS_STATUS_WAITING_FOR_SUPPLIERS)this.disabled=true}}}},getRejectButton:function(){var me=this;return{text:"\u041e\u0442\u043a\u043b\u043e\u043d\u0438\u0442\u044c",handler:function(){var windowId=Ext.id();(new Ext.Window({id:windowId,closeAction:"close",width:600,height:250,modal:true,layout:"fit",title:"\u041e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435 \u043f\u0430\u043a\u0435\u0442\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430", items:[{xtype:"Application.components.DocumentsRejectForm",contractdocuments_id:me.values.id,successCallback:function(resp){Ext.getCmp(windowId).close();Main.app.run()}}]})).show()}}},getAssignButton:function(){var me=this;return{text:"\u041f\u0440\u0438\u043d\u044f\u0442\u044c",handler:function(){CryptoApi.signMessage({message:"\u0421\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0442\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432"}, function(signatureValue){performRPCCall(RPC.Contractdocuments.resolve,[{contractdocuments_id:me.values.id,signature:signatureValue}],{wait_text:"\u0418\u0434\u0435\u0442 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445"},function(resp){if(!resp.success){echoResponseMessage(resp);return}echoResponseMessage({success:true,message:"\u041a\u043e\u043c\u043f\u043b\u0435\u043a\u0442 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0431\u044b\u043b \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043f\u0440\u0438\u043d\u044f\u0442"}, function(){if(me.is_additional_supplier)redirect_to("com/procedure/index");else redirect_to("#com/contract/index/lot/"+me.lot_id)})})})}}},getCloseButton:function(){return{text:"\u0417\u0430\u043a\u0440\u044b\u0442\u044c",handler:function(){history.back(1)}}},isCustomer:function(customer){var me=this;var isCustomer=false;if(customer===me.procedure.organizer_contragent_id)isCustomer=true;Ext.iterate(me.procedure.lots,function(lot){Ext.iterate(lot["lot_customers"],function(lotCustomer){if(lotCustomer["id"]== customer)isCustomer=true})});return isCustomer},isSupplier:function(supplier){var me=this;var isSupplier=false;if(me.values.supplier_id===supplier)isSupplier=true;return isSupplier},isAdditionalSupplier:function(supplier_id){var me=this;if(!me.values.additional_suppliers||me.values.additional_suppliers.length<1)return false;var isAdditionalSupplier=false;Ext.iterate(me.values.additional_suppliers,function(additional_supplier){if(additional_supplier.supplier_id===supplier_id)isAdditionalSupplier=true}); return isAdditionalSupplier},addButtons:function(values){var me=this;if(me.values.date_signed)me.addButton(me.getSignatureButton());if(values.status>CONTRACT_DOCUMENTS_STATUS_DRAFT)me.addButton(me.getDownloadButton());me.addButton("->");if(values.status===CONTRACT_DOCUMENTS_STATUS_REVIEW&&me.isCustomer(Main.contragent.id)){me.addButton(me.getAssignButton());me.addButton(me.getRejectButton())}if(values.status===CONTRACT_DOCUMENTS_STATUS_WAITING_FOR_SUPPLIERS&&me.isAdditionalSupplier(Main.contragent.id)&& !me.isReadOnly(Main.contragent.id))me.addButton(me.getAdditionalSubmitButton());if(in_array(values.status,[CONTRACT_DOCUMENTS_STATUS_DEJECTED,CONTRACT_DOCUMENTS_STATUS_DRAFT])&&me.isSupplier(Main.contragent.id)&&!me.isReadOnly(Main.contragent.id))me.addButton(me.getSubmitButton());me.addButton(me.getCloseButton())},isReadOnly:function(supplier_id){var me=this;if(in_array(me.values.status,[CONTRACT_DOCUMENTS_STATUS_DRAFT,CONTRACT_DOCUMENTS_STATUS_DEJECTED])&&this.isSupplier(supplier_id))return false; if(me.values.status===CONTRACT_DOCUMENTS_STATUS_WAITING_FOR_SUPPLIERS&&me.isAdditionalSupplier(supplier_id)&&!me.isSignedBySupplier(supplier_id))return false;return true},isSignedBySupplier:function(supplier_id){var me=this;if(!me.isSupplier(supplier_id)&&!me.isAdditionalSupplier(supplier_id))return false;if(me.isSupplier(supplier_id))return!isEmpty(me.values.date_signed);if(me.isAdditionalSupplier(supplier_id)){var isSignedByAdditionalSupplier=false;Ext.iterate(me.values.additional_suppliers,function(additional_supplier){if(additional_supplier.supplier_id=== supplier_id&&!isEmpty(additional_supplier.date_signed))isSignedByAdditionalSupplier=true});return isSignedByAdditionalSupplier}return false},addPanels:function(values){var me=this;me.removeAll(true);me.add(me.getSupplierInfoPanel(values.supplier,me.getAdditionalSuppliersInfoPanel(values.additional_suppliers)));if(values.status>CONTRACT_DOCUMENTS_STATUS_DRAFT)me.add(me.getStatusPanel(values.status,values.reason_declined));if(!isEmpty(values.additional_suppliers))me.add(me.getAdditionalSupplierSignaturesPanel(values.additional_suppliers)); me.add(me.getFilesPanel(values.files,me.isReadOnly(Main.contragent.id)||me.isAdditionalSupplier(Main.contragent.id)))},setValues:function(values){var me=this;me.values=values;me.addPanels(values);me.addButtons(values);me.doLayout()},setProcedure:function(procedure){this.procedure=procedure},onBeforerender:function(){var me=this;if(!!me.values){me.setValues(me.values);me.setProcedure(me.procedure);return}performRPCCall(RPC.Contractdocuments.load,[{lot_id:me.lot_id}],{},function(resp){if(resp.success)me.setValues(resp.data); else echoResponseMessage(resp)})},initComponent:function(){var me=this;Ext.apply(me,{items:[me.getLoadingFieldset()],listeners:{beforerender:me.onBeforerender}});Application.components.ContractDocumentsFormPanel.superclass.initComponent.call(this)}});Ext.define("Application.components.ContractDocumentsPanel",{extend:"Ext.panel.Panel",frame:true,border:false,padding:5,waitParams:{mask:true,scope:this,monitor_valid:this,wait_text:"\u0418\u0434\u0435\u0442 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445",handle_failure:false},lot_id:null,supplier_id:null,getProcedureInfoPanel:function(data,lotId){var me=this;return{ref:"procedureShortViewCmp",xtype:"Application.components.ProcedureLotShortViewPanel",values:data, lotId:lotId}},getContractDocumentsTabPanel:function(){return{ref:"contractDocumentsTabPanelCmp",cls:"spaced-panel",xtype:"Application.components.ContractDocumentsTabPanel"}},getContractDocumentsSinglePanel:function(data,supplier_id){var me=this;return{ref:"contractDocumentsSinglePanelCmp",xtype:"Application.components.ContractDocumentsFormPanel",title:"\u0414\u0430\u043d\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0442\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432", showCloseButton:true,lot_id:me.lot_id,supplier_id:supplier_id,procedure:data.procedure,values:data.data[supplier_id]}},getNoDocumentsPanel:function(){return{xtype:"Application.components.InformationFieldset",text:"\u041d\u0435\u0442 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0442\u043e\u0432 \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f"}},onAfterrender:function(){var me=this;performRPCCall(RPC.Contractdocuments.load,[{lot_id:me.lot_id,supplier_id:me.supplier_id}], me.waitParams,function(resp){if(!resp||!resp.success){echoResponseMessage(resp);return}me.removeAll();me.add(me.getProcedureInfoPanel(resp.procedure,me.lot_id));if(isEmpty(resp.data))me.add(me.getNoDocumentsPanel());else if(!!resp.supplier_id&&resp.supplier_id===Main.contragent.id)me.add(me.getContractDocumentsSinglePanel(resp,resp.supplier_id));else if(resp.suppliers&&resp.suppliers.length==1)me.add(me.getContractDocumentsSinglePanel(resp,resp.suppliers[0]));else{me.add(me.getContractDocumentsTabPanel()); me.contractDocumentsTabPanelCmp.lot_id=me.lot_id;me.contractDocumentsTabPanelCmp.fireEvent("dataload",resp.procedure,resp.data)}me.doLayout()})},getDataLoadingPanel:function(){return{xtype:"Application.components.LoadingFieldset"}},getButtons:function(){return[{text:"\u0417\u0430\u043a\u0440\u044b\u0442\u044c",handler:function(){history.back(1)}}]},initComponent:function(){var me=this;Ext.apply(me,{items:[me.getDataLoadingPanel()],listeners:{afterrender:me.onAfterrender}});Application.components.ContractDocumentsPanel.superclass.initComponent.call(this)}});Ext.define("Application.components.ContractDocumentsTabPanel",{extend:"Ext.TabPanel",layoutOnTabChange:true,autoHeight:true,waitParams:{mask:true,scope:this,monitor_valid:this,wait_text:"\u0418\u0434\u0435\u0442 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445",handle_failure:false},frame:false,lot_id:null,procedure:null,values:[],onDataload:function(procedure,data){var me=this;me.procedure=procedure;this.setValues(data)},getContractDocumentsPanel:function(itemData){var me= this;return{title:itemData.supplier.short_name,items:[{xtype:"Application.components.ContractDocumentsFormPanel",padding:5,style:"margin: 0 0 20px 0",lot_id:me.lot_id,procedure:me.procedure,values:itemData}]}},onAfterrender:function(){var me=this;if(!isEmpty(me.values))this.setValues(me.values)},initComponent:function(){var me=this;me.addEvents("dataload");Ext.apply(me,{items:[],listeners:{afterrender:me.onAfterrender,dataload:me.onDataload}});Application.components.ContractDocumentsTabPanel.superclass.initComponent.call(this)}, setValues:function(data){var me=this;me.removeAll();Ext.iterate(data,function(i,itemData){me.add(me.getContractDocumentsPanel(itemData))});me.setActiveTab(0);me.doLayout()}});Ext.define("Application.components.DocumentsRejectForm",{extend:"Ext.form.FormPanel",monitorValid:true,frame:true,border:false,successCallback:null,layout:{type:"vbox",align:"stretch",defaultMargins:{top:5,right:5,bottom:0,left:5}},contractdocuments_id:null,initComponent:function(){var component=this;Ext.apply(component,{items:[{html:"\u0423\u043a\u0430\u0436\u0438\u0442\u0435 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u043b\u044f \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f:", cls:"spaced-bottom-shallow",autoHeight:true},{xtype:"textarea",flex:1,ref:"commentCmp",allowBlank:false,anchor:"100%"}],buttons:[{text:"\u041f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c \u0438 \u043d\u0430\u043f\u0440\u0430\u0432\u0438\u0442\u044c",scope:this,formBind:true,handler:function(){var commentText=component.commentCmp.getValue();CryptoApi.signMessage({message:commentText},function(signature){performRPCCall(RPC.Contractdocuments.reject,[{contractdocuments_id:component.contractdocuments_id, comment:commentText,signature:signature}],null,function(resp){echoResponseMessage(resp,function(){if(!!component.successCallback)component.successCallback()})})})}}]});Application.components.DocumentsRejectForm.superclass.initComponent.call(this)}});Ext.define("Application.components.ContractExecutionChangesPanel",{extend:"Ext.panel.Panel",layout:"form",labelWidth:350,defaults:{anchor:"100%"},initComponent:function(){var me=this;Ext.apply(me,{items:[{xtype:"label",fieldLabel:"\u041f\u0440\u0438\u0447\u0438\u043d\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e\u0431 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"+ REQUIRED_FIELD},{xtype:"textarea",name:"modificationDescription",hideLabel:true,anchor:"100%",grow:true,allowBlank:false}]});Application.components.ContractExecutionChangesPanel.superclass.initComponent.call(this)},setValues:function(values){setComponentValues(this,values)},getValues:function(){var values={};collectComponentValues(this,values);return values}});Ext.define("Application.components.ContractExecutionGrid",{extend:"Ext.grid.Panel",title:"\u041f\u043e\u0437\u0438\u0446\u0438\u0438 \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u0439 \u043e\u0431 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438",border:true,contractPositions:null,currencyStore:null,countriesStore:null,dataStore:null,store:null,summaryId:null,parentCmp:null,createDataStore:function(){var me=this;return new Ext.data.JsonStore({idProperty:"id",fields:["id","acceptanceDocs", "paymentsInfo","uniqueDocs"],listeners:{add:function(){me.refreshViewStore.call(me)},remove:function(){me.refreshViewStore.call(me)},update:function(){me.refreshViewStore.call(me)},load:function(){me.refreshViewStore.call(me)}}})},getDataStore:function(){return this.dataStore},setDataStore:function(store){this.dataStore=store},refreshViewStore:function(){var dataStore=this.getDataStore();var viewStore=this.getViewStore();var viewRecords=[];var getAcceptanceDoc=function(allDocs,doc_internal_uuid){var result; Ext.iterate(allDocs,function(doc){if(doc["doc_internal_uuid"]===doc_internal_uuid)result=doc});return result};var calculateRubSum=function(data){var currencyRate=data["currency"]===810?1:data.currencyRate;return data["price"]*currencyRate};var no=1;dataStore.each(function(dataRecord){var data=dataRecord.data;Ext.iterate(data["paymentsInfo"],function(payment,pi){var docUuids=payment["contractAcceptanceDocs"].split(",");Ext.iterate(docUuids,function(docUuid,i){if(!docUuid||docUuid=="0")return;var doc= getAcceptanceDoc(data["acceptanceDocs"],docUuid);var viewRecordData={id:generateRandomUUID(),no:no,record_id:data["id"],payment_date:i==0?payment["paymentDate"]:null,payment_sum_rub:i==0?payment["price"]:null,prepaid:i==0?payment["prepaid"]:null,doc_title:doc["doc_title"],contract_position:doc["contractPosition"],qty:doc["qty"],price:doc["unitPrice"],is_prepaid:doc["prepayment"],showbuttons:i===0&&pi===0};if(i===0){viewRecordData["sum_rub"]=calculateRubSum(payment);viewRecordData["financialVolumePositionRub"]= doc["contractPosition"]["financialVolumePositionRub"]||0}viewRecords.push(viewRecordData)})});no++});viewStore.loadData(viewRecords)},createViewStore:function(){return new Ext.data.GroupingStore({reader:new Ext.data.JsonReader({idProperty:"id",fields:["id","no","record_id","payment_date","payment_sum_rub","prepaid","doc_title","contract_position","qty","okei_unit","price","finance","is_prepaid","showbuttons","sum_rub","financialVolumePositionRub"]}),groupField:"record_id",sortInfo:{field:"record_id", direction:"ASC"}})},getViewStore:function(){return this.store},setViewStore:function(store){this.store=store},setCurrencyStore:function(store){this.currencyStore=store},setCountriesStore:function(store){this.countriesStore=store},getColumns:function(){var me=this;return[{header:"\u0417\u0430\u043f\u0438\u0441\u044c",dataIndex:"record_id",hidden:true},{header:"\u0414\u0430\u0442\u0430 \u043e\u043f\u043b\u0430\u0442\u044b",dataIndex:"payment_date",width:30,renderer:Ext.util.Format.dateRenderer("d.m.Y")}, {header:"\u0421\u0443\u043c\u043c\u0430 \u043e\u043f\u043b\u0430\u0442\u044b \u0432 \u0440\u0443\u0431.",dataIndex:"sum_rub",width:30,renderer:Ext.util.Format.priceRubRenderer},{header:"\u0410\u0432\u0430\u043d\u0441\u043e\u0432\u044b\u0439 \u043f\u043b\u0430\u0442\u0435\u0436",dataIndex:"prepaid",width:50,renderer:Ext.util.Format.yesOrUnsetRenderer},{header:"\u041d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435, \u043d\u043e\u043c\u0435\u0440 \u0438 \u0434\u0430\u0442\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 \u043f\u0440\u0438\u0435\u043c\u043a\u0438 (\u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u043a \u043e\u043f\u043b\u0430\u0442\u0435)", flex:1,width:100,dataIndex:"doc_title"},{header:"\u041f\u043e\u0437\u0438\u0446\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430",hidden:true,width:100,dataIndex:"contract_position",renderer:function(value,meta,record){var contractPosition=record.get("contract_position");if(contractPosition&&contractPosition["unit_name"])return contractPosition["unit_name"];return"-"}},{header:"\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e (\u043e\u0431\u044a\u0435\u043c), \u0435\u0434\u0438\u043d\u0438\u0446\u0430 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f", width:30,hidden:true,dataIndex:"qty"},{header:"\u0426\u0435\u043d\u0430 \u0437\u0430 \u0435\u0434\u0438\u043d\u0438\u0446\u0443",hidden:true,width:30,dataIndex:"price",renderer:Ext.util.Format.priceRenderer},{header:"\u041e\u0431\u044a\u0435\u043c \u0444\u0438\u043d\u0430\u043d\u0441\u043e\u0432\u043e\u0433\u043e \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f",hidden:true,width:30,dataIndex:"finance",renderer:function(value,meta,record){var contractPosition=record.get("contract_position"); if(contractPosition&&contractPosition.financialVolumePositionRub)return(Ext.util.Format.formatPrice(contractPosition.amountOfBudgetFunds)||"")+("
      \u041a\u0426\u0421: "+contractPosition.targetCode||"")+("
      \u041a\u0412\u0420: "+contractPosition.typeCode||"");return"\u041d\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f"}},{header:"\u041e\u043f\u043b\u0430\u0442\u0430 \u0430\u0432\u0430\u043d\u0441\u043e\u043c",dataIndex:"is_prepaid",width:30,renderer:Ext.util.Format.yesOrUnsetRenderer}, {header:"\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u0438",xtype:"textactioncolumn",width:30,actionsSeparator:" ",width:50,items:[{tooltip:"\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c",icon:"/ico/edit.png",isShown:function(value,p,record){return record.get("showbuttons")},text:"",handler:function(grid,rowIndex){var store=me.getViewStore();var viewRecord=store.getAt(rowIndex);var dataStore=me.getDataStore();var dataRecord=null;dataStore.each(function(dataStoreRecord){if(dataStoreRecord.get("id")=== viewRecord.get("record_id"))dataRecord=dataStoreRecord});me.fireEvent("editRecord",dataRecord,false)}},{tooltip:"\u0423\u0434\u0430\u043b\u0438\u0442\u044c",icon:"/ico/delete.png",isShown:function(value,p,record){return record.get("showbuttons")},text:"",handler:function(grid,rowIndex){me.fireEvent("deleteRecord",rowIndex)}}]}]},onEditRecord:function(storeRecord,isNew){var me=this;var saveButtonId=Ext.id();var win=new Ext.Window({closeAction:"close",width:"90%",height:500,modal:true,resizable:true, maximizable:true,title:"\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u0439 \u043e\u0431 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438",layout:"fit",items:[{xtype:"Application.components.ContractExecutionGridRowPanel",ref:"contractExecutionGridRowPanel",autoSelectPosition:isNew,contractPositions:me.contractPositions,countriesStore:me.countriesStore,currencyStore:me.currencyStore, parentCmp:me,listeners:{afterrender:function(cmp){if(!isNew)cmp.setValues(storeRecord.data)},datachanged:function(store1,store2){var saveButton=Ext.getCmp(saveButtonId);if(saveButton&&store1&&store2)saveButton.setDisabled(store1.getCount()<1||store2.getCount()<1)}}}],buttons:[{text:"\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c",disabled:true,id:saveButtonId,handler:function(){var docs_store=win.contractExecutionGridRowPanel.docsStore;var parent=me.parentCmp.parentCmp;if(parent&&docs_store){var values= parent.infoPanel.getValues();var totalSum=0;docs_store.each(function(record){totalSum+=me.calculateRubSum(record.data)});if(values.price&&totalSum>values.price){Ext.Msg.alert("\u041e\u0448\u0438\u0431\u043a\u0430","\u0421\u0443\u043c\u043c\u0430 \u043f\u043e \u043f\u043e\u0437\u0438\u0446\u0438\u044f\u043c \u0432\u0441\u0435\u0445 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0439 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0442\u044c \u0446\u0435\u043d\u0443 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430").setIcon(Ext.MessageBox.ERROR); return}}storeRecord.data=Ext.apply(storeRecord.data,win.contractExecutionGridRowPanel.getValues());if(isNew){storeRecord.data.id=generateRandomUUID();me.getDataStore().add(storeRecord)}storeRecord.commit();win.close()}},{text:"\u041e\u0442\u043c\u0435\u043d\u0430",handler:function(){win.close()}}]});win.show()},onDeleteRecord:function(rowIndex){var me=this;var store=me.getViewStore();var viewRecord=store.getAt(rowIndex);var dataStore=me.getDataStore();var dataRecord=null;var i=0;dataStore.each(function(dataStoreRecord){if(dataStoreRecord.get("id")=== viewRecord.get("record_id")){dataStore.removeAt(i);return false}i++});me.refreshViewStore()},initViewStoreEvents:function(){var me=this;var viewStore=me.getViewStore();var handler=function(){me.fireEvent("viewStoreChanged",viewStore)};if(viewStore){viewStore.on("add",handler);viewStore.on("remove",handler);viewStore.on("load",handler);viewStore.on("update",handler)}},onViewStoreChanged:function(store){var totalSum=0;var totalGovSum=0;var me=this;store.each(function(record){totalSum+=record.get("sum_rub")|| 0;var contractPosition=record.get("contract_position");if(contractPosition&&contractPosition.financialVolumePositionRub)totalGovSum+=contractPosition.amountOfBudgetFunds||0});var summary=Ext.getCmp(me.summaryId);if(summary)summary.setText("\u0418\u0442\u043e\u0433\u043e: "+Ext.util.Format.formatPrice(totalSum)+" "+RUB_SIGN+"
      "+"\u0418\u0442\u043e\u0433\u043e \u0437\u0430 \u0441\u0447\u0435\u0442 \u0431\u044e\u0434\u0436\u0435\u0442\u043d\u044b\u0445 \u0441\u0440\u0435\u0434\u0441\u0442\u0432: "+ Ext.util.Format.formatPrice(totalGovSum)+" "+RUB_SIGN)},initComponent:function(){var me=this;me.addEvents("editRecord","deleteRecord","viewStoreChanged");me.setDataStore(me.createDataStore());me.setViewStore(me.createViewStore());me.initViewStoreEvents();me.summaryId=Ext.id();Ext.apply(me,{columns:me.getColumns(),autoHeight:true,view:new Ext.grid.GroupingView({forceFit:true,autoFill:true,enableGroupingMenu:false,enableNoGroups:false,markDirty:false,deferEmptyText:false,emptyText:"\u041d\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0445", groupTextTpl:"\u041f\u043e\u0437\u0438\u0446\u0438\u044f {[values.rs[0].data.no]}"}),bbar:[{id:me.summaryId,xtype:"tbtext"},"->",{cls:"x-btn-text-icon",icon:"ico/add.png",text:"\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c",handler:function(){var store=me.getDataStore();var newRecord=new store.recordType({});me.fireEvent("editRecord",newRecord,true)}}],listeners:{editRecord:me.onEditRecord,deleteRecord:me.onDeleteRecord,viewStoreChanged:me.onViewStoreChanged}});Application.components.ContractExecutionGrid.superclass.initComponent.call(this)}, loadContractPositions:function(arrayData){var me=this;me.contractPositions=arrayData},getValues:function(){var values=[];this.getDataStore().each(function(record){values.push(record.data)});return values},setValues:function(data){this.getDataStore().loadData(data)},calculateRubSum:function(data){var currencyRate=data["currency"]===810||data["currency"]==="\u0420\u043e\u0441\u0441\u0438\u0439\u0441\u043a\u0438\u0439 \u0440\u0443\u0431\u043b\u044c"?1:data.exchangeRate;return data["unitPrice"]*(data["qty"]|| 1)*currencyRate}});Ext.define("Application.components.ContractExecutionGridRowAcceptanceDocsCommonForm",{extend:"Ext.form.Panel",frame:true,border:false,initComponent:function(){var me=this;Ext.apply(me,{labelWidth:200,defaults:{allowBlank:false,defaults:{allowBlank:false,labelWidth:250}},padding:10,items:[{name:"name",xtype:"combo",store:me.documentTypesStore,triggerAction:"all",mode:"local",valueField:"id",displayField:"name",editable:false,allowBlank:false,forceSelection:true,fieldLabel:"\u041d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430"+ REQUIRED_FIELD,width:300,minListWidth:600},{xtype:"textfield",fieldLabel:"\u041d\u043e\u043c\u0435\u0440 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430"+REQUIRED_FIELD,width:150,allowBlank:false,name:"doc_number"},{xtype:"datefield",fieldLabel:"\u0414\u0430\u0442\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430"+REQUIRED_FIELD,width:150,allowBlank:false,name:"date"}]});Application.components.ContractExecutionGridRowAcceptanceDocsCommonForm.superclass.initComponent.call(this)}, getValues:function(){var me=this;if(!me.getForm().isValid())return null;var values={};collectComponentValues(me,values);return values}});Ext.define("Application.components.ContractExecutionGridRowAcceptanceDocsGrid",{extend:"Ext.grid.EditorGridPanel",editable:true,border:true,contractPositions:null,plugins:[Ext.ux.plugins.GridRowEditor],documentTypesStore:null,objectTypeStore:null,dialogWidth:700,currencyStore:null,countriesStore:null,okeiStore:null,hideAddButton:false,isEmbeded:false,uniqueDocsStore:null,hideCountries:false,parentCmp:null,summaryId:null,createContractPositionsStore:function(){var me=this;var arrayData=me.contractPositions; Ext.iterate(arrayData,function(data,i){arrayData[i]["id"]=i+1});return new Ext.data.JsonStore({autoDestroy:false,autoLoad:true,idProperty:"id",paramsAsHash:true,fields:["id","amountOfBudgetFunds","countriesOfOrigin","countryManufacturer","financialVolumePositionRub","targetCode","typeCode","type_object_purchase","unit_guid","unit_name","unit_okei","unit_okpd2","unit_pos","unit_price","unit_quantity","unit_currency"],data:arrayData})},extractRowContractPositions:function(values){var me=this;var rowsArray= [];var contractPositionsStore=me.createContractPositionsStore();var contractPosition_ids=values["contractPosition_ids"].toString().split(",");Ext.iterate(contractPosition_ids,function(position_id){var localValues=JSON.parse(JSON.stringify(values));var contractPosition=contractPositionsStore.getById(position_id);localValues["contractPosition_ids"]=position_id;localValues["contractPosition"]=contractPosition?contractPosition.data:{};rowsArray.push(localValues)});return rowsArray},rowSaveHandler:function(values, row,isInserting){var me=this;Ext.iterate(values,function(name,val){row.set(name,val)})},getEditor:function(form,isInsertingMode){var me=this;var countryManufacturerCombo=new Application.components.CountriesCombo;var countriesOfOrigin\u0421ombo=new Application.components.CountriesCombo;var calculateRubSum=function(){var qty=form.qtyField.getValue()||1;var price=form.unitPriceField.getValue()||0;var rate=form.exchangeRateField.getValue()||1;form.totalRubField.setValue(qty*price*rate);form.rubUnitPriceField.setValue(price* rate)};return[{name:"name",xtype:"combo",store:me.documentTypesStore,triggerAction:"all",mode:"local",valueField:"id",displayField:"name",editable:false,allowBlank:false,forceSelection:true,disabled:true,minListWidth:630,fieldLabel:"\u041d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430"},{name:"number",xtype:"textfield",disabled:true,fieldLabel:"\u041d\u043e\u043c\u0435\u0440 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430"}, {name:"date",xtype:"datefield",disabled:true,fieldLabel:"\u0414\u0430\u0442\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430"},{name:"contractPosition_id",xtype:"combo",multiSelect:true,store:me.createContractPositionsStore(),mode:"local",valueField:"id",displayField:"unit_name",triggerAction:"all",editable:false,allowBlank:false,fieldLabel:"\u041f\u043e\u0437\u0438\u0446\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"},{name:"type_object_purchase",xtype:"combo",fieldLabel:"\u0422\u0438\u043f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0437\u0430\u043a\u0443\u043f\u043a\u0438", store:me.objectTypeStore,triggerAction:"all",mode:"local",valueField:"id",displayField:"name",editable:false,allowBlank:false,forceSelection:true},Ext.apply(countryManufacturerCombo,{fieldLabel:"\u0421\u0442\u0440\u0430\u043d\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0442\u043e\u0432\u0430\u0440\u0430",name:"countriesOfOrigin"}),Ext.apply(countriesOfOrigin\u0421ombo,{fieldLabel:"\u0421\u0442\u0440\u0430\u043d\u0430 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u0442\u043e\u0432\u0430\u0440\u0430", name:"countryManufacturer"}),{name:"qty",ref:"qtyField",xtype:"textfield",fieldLabel:"\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e (\u043e\u0431\u044a\u0435\u043c) \u0442\u043e\u0432\u0430\u0440\u043e\u0432, \u0440\u0430\u0431\u043e\u0442, \u0443\u0441\u043b\u0443\u0433",listeners:{change:function(cmp,newValue){calculateRubSum()}}},{xtype:"Application.components.OkeiCombo",fieldLabel:"\u0415\u0434\u0438\u043d\u0438\u0446\u0430 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f", name:"okei"},{name:"unitPrice",ref:"unitPriceField",xtype:"Application.components.priceField",fieldLabel:"\u0426\u0435\u043d\u0430 \u0437\u0430 \u0435\u0434\u0438\u043d\u0438\u0446\u0443",listeners:{change:function(cmp,newValue){calculateRubSum()}}},{name:"currency",xtype:"Application.components.CurrencyCombo",store:me.currencyStore,fieldLabel:"\u0412\u0430\u043b\u044e\u0442\u0430",listeners:{select:function(cmp,record){form.exchangeRateField.setVisible(record.get("id")!==810);form.rubUnitPriceField.setVisible(record.get("id")!== 810)}}},{name:"exchangeRate",xtype:"Application.components.priceField",ref:"exchangeRateField",fieldLabel:"\u041a\u0443\u0440\u0441 \u0432\u0430\u043b\u044e\u0442\u044b, \u0440\u0443\u0431.",hidden:true,value:1,listeners:{change:function(cmp,newValue){calculateRubSum()}}},{name:"rubUnitPrice",xtype:"Application.components.priceField",ref:"rubUnitPriceField",fieldLabel:"\u0426\u0435\u043d\u0430 \u0437\u0430 \u0435\u0434\u0438\u043d\u0438\u0446\u0443 \u0432 \u0440\u0443\u0431\u043b\u0435\u0432\u043e\u043c \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u0435", disabled:true,hidden:true},{name:"totalRub",xtype:"Application.components.priceField",ref:"totalRubField",fieldLabel:"\u0421\u0443\u043c\u043c\u0430 \u043f\u043e \u043f\u043e\u0437\u0438\u0446\u0438\u0438, \u0440\u0443\u0431.",disabled:true},{name:"prepayment",xtype:"checkbox",submitValue:false,fieldLabel:"\u041e\u043f\u043b\u0430\u0442\u0430 \u0430\u0432\u0430\u043d\u0441\u043e\u043c"}]},docTitleRenderer:function(value,meta,record){var me=this;var name=record.get("name")?me.documentTypesStore.getById(record.get("name")).get("name"): "";var number=record.get("number");var date=record.get("date");return name+" \u2116"+number+", \u043e\u0442 "+(date?humanizeDate(date):"")},getColumns:function(){var me=this;var countryManufacturerCombo=new Application.components.CountriesCombo;var countriesOfOrigin\u0421ombo=new Application.components.CountriesCombo;return[new Ext.grid.RowNumberer({width:20}),{header:"\u041d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435, \u043d\u043e\u043c\u0435\u0440 \u0438 \u0434\u0430\u0442\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 \u043f\u0440\u0438\u0435\u043c\u043a\u0438", width:50,scope:me,renderer:me.docTitleRenderer},{header:"\u041f\u043e\u0437\u0438\u0446\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430",width:50,renderer:function(value,meta,record){var contractPosition=record.get("contractPosition");return!isEmpty(contractPosition)?contractPosition.unit_name:""}},{header:"\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e (\u043e\u0431\u044a\u0435\u043c) \u0438 \u0435\u0434\u0438\u043d\u0438\u0446\u0430 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f", dataIndex:"qty",editable:true,editor:Ext.ux.helpers.textEdit(),renderer:function(value,meta,record){var okei=record.get("okei");var okeiRecord=okei?me.okeiStore.getById(okei):null;return record.get("qty")+" "+(okeiRecord?okeiRecord.get("symbol").toLowerCase():"")},width:20},{header:"\u0426\u0435\u043d\u0430 \u0437\u0430 \u0435\u0434\u0438\u043d\u0438\u0446\u0443",dataIndex:"unitPrice",editable:true,editor:Ext.ux.helpers.textEdit(),renderer:function(value){return!isEmpty(value)?Ext.util.Format.formatPrice(value): ""},width:20},{header:"\u0421\u0442\u0440\u0430\u043d\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0442\u043e\u0432\u0430\u0440\u0430",width:20,dataIndex:"countriesOfOrigin",allowBlank:true,editor:countriesOfOrigin\u0421ombo,hidden:!!me.hideCountries,renderer:Ext.util.Format.comboRenderer(countriesOfOrigin\u0421ombo)},{header:"\u0421\u0442\u0440\u0430\u043d\u0430 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u0442\u043e\u0432\u0430\u0440\u0430", width:20,dataIndex:"countryManufacturer",allowBlank:true,editor:countryManufacturerCombo,hidden:!!me.hideCountries,renderer:Ext.util.Format.comboRenderer(countryManufacturerCombo)},{header:"\u041e\u0431\u044a\u0435\u043c \u0444\u0438\u043d\u0430\u043d\u0441\u043e\u0432\u043e\u0433\u043e \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f",width:20,renderer:function(value,meta,record){var contractPosition=record.get("contractPosition");if(contractPosition&&contractPosition.financialVolumePositionRub)return(Ext.util.Format.formatPrice(contractPosition.amountOfBudgetFunds)|| "")+("
      \u041a\u0426\u0421: "+contractPosition.targetCode||"")+("
      \u041a\u0412\u0420: "+contractPosition.typeCode||"");return"\u041d\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f"}},{header:"\u0421\u0443\u043c\u043c\u0430 \u043f\u043e \u043f\u043e\u0437\u0438\u0446\u0438\u0438, \u0440\u0443\u0431.",width:20,dataIndex:"totalRub",renderer:function(value,meta,record){return Ext.util.Format.formatPrice(me.calculateRubSum(record.data))+" "+RUB_SIGN}},{header:"\u041e\u043f\u043b\u0430\u0442\u0430 \u0430\u0432\u0430\u043d\u0441\u043e\u043c", dataIndex:"prepayment",width:15,renderer:function(value,meta,record){return value?"\u0414\u0430":"\u041d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043e"}},{header:"\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u0438",xtype:"textactioncolumn",actionsSeparator:" ",width:20,items:[{icon:"/ico/edit.png",tooltip:"\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443",handler:function(grid,rowIndex){grid.fireEvent("rowediting",rowIndex)}},{icon:"/ico/delete.png", tooltip:"\u0423\u0434\u0430\u043b\u0438\u0442\u044c",handler:function(grid,rowIndex){var record=grid.getStore().getAt(rowIndex);if(!me.isEmbeded&&me.parentCmp.contractExecutionGridRowPaymentsGrid.isDocumentInGridRows(record.get("doc_internal_uuid"))){alertError("\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c, \u0442.\u043a. \u0434\u0430\u043d\u043d\u044b\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u043f\u0440\u0438\u0435\u043c\u043a\u0438 \u0443\u043a\u0430\u0437\u0430\u043d \u0432 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e\u0431 \u043e\u043f\u043b\u0430\u0442\u0435"); return}grid.getStore().removeAt(rowIndex);grid.view.refresh()}}]}]},onAddRow:function(){var me=this;var saveButtonId=Ext.id();var uniqueDocsStore=me.parentCmp.createUniqueDocsStore();var documentTypesStore=me.parentCmp.createDocumentTypesStore();var docsStore=me.parentCmp.createDocsStore();var win=new Ext.Window({closeAction:"close",width:"90%",minHeight:700,height:"80%",modal:true,resizable:true,maximizable:true,title:"\u041d\u043e\u0432\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0445 \u043f\u0440\u0438\u0435\u043c\u043a\u0438", layout:"fit",buttonAlign:"left",items:[{xtype:"Application.components.ContractExecutionGridRowAcceptanceDocsMultiPanel",ref:"contractExecutionGridRowAcceptanceDocsMultiPanel",contractPositions:me.contractPositions,objectTypeStore:me.objectTypeStore,documentTypesStore:me.documentTypesStore,countriesStore:me.countriesStore,docsStore:docsStore,uniqueDocsStore:uniqueDocsStore,listeners:{storechanged:function(store){var saveButton=Ext.getCmp(saveButtonId);if(saveButton&&store)saveButton.setDisabled(store.getCount()< 1)}}}],buttons:[{text:"\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0438\u0437 \u0444\u0430\u0439\u043b\u0430",cls:"contract-upload-button",handler:function(){var window=new Ext.Window({autoHeight:true,width:600,closeAction:"close",modal:true,title:"\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043f\u043e\u0437\u0438\u0446\u0438\u0439 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430",layout:"fit",items:[{xtype:"Application.components.ContractUploadDocsPanel", border:false,autoheight:true,frame:true,listeners:{cancelled:function(){window.close()},uploadComplete:function(response){var doUpdate=function(){var destStore=win.contractExecutionGridRowAcceptanceDocsMultiPanel.destinationGrid.getStore();destStore.removeAll(true);var errors=[];Ext.iterate(response.result.data,function(currentRow,i){var has_errors=false;var fields={"date":"\u0414\u0430\u0442\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430","name":"\u041d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430", "number":"\u041d\u043e\u043c\u0435\u0440 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430","contractPositionName":"\u041f\u043e\u0437\u0438\u0446\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430","type_object_purchase":"\u0422\u0438\u043f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0437\u0430\u043a\u0443\u043f\u043a\u0438","qty":"\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e (\u043e\u0431\u044a\u0435\u043c) \u0442\u043e\u0432\u0430\u0440\u043e\u0432","okei":"\u0415\u0434\u0438\u043d\u0438\u0446\u0430 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f", "unitPrice":"\u0426\u0435\u043d\u0430 \u0437\u0430 \u0435\u0434\u0438\u043d\u0438\u0446\u0443","currency":"\u0412\u0430\u043b\u044e\u0442\u0430","countriesOfOrigin":"\u0421\u0442\u0440\u0430\u043d\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0442\u043e\u0432\u0430\u0440\u0430"};for(var prop in fields)if(currentRow[prop]===""){errors.push("\u0421\u0442\u0440\u043e\u043a\u0430 \u2116 "+(i+3)+" \u043d\u0435 \u0431\u044b\u043b\u0430 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u0430, \u0442\u0430\u043a \u043a\u0430\u043a \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u044b \u0432\u0441\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f"); return}var documentType=me.documentTypesStore.findExact("name",currentRow.name);if(documentType<0){errors.push("\u0421\u0442\u0440\u043e\u043a\u0430 \u2116 "+(i+3)+" \u043d\u0435 \u0431\u044b\u043b\u0430 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u0430, \u0442\u0430\u043a \u043a\u0430\u043a \u041d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 \u043d\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0441\u043f\u0440\u0430\u0432\u043e\u0447\u043d\u0438\u043a\u0443 \u043d\u0430 \u042d\u0422\u041f"); has_errors=true}else currentRow.name=me.documentTypesStore.getAt(documentType).get("id");if(!currentRow.okei){errors.push("\u0421\u0442\u0440\u043e\u043a\u0430 \u2116 "+(i+3)+" \u043d\u0435 \u0431\u044b\u043b\u0430 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u0430, \u0442\u0430\u043a \u043a\u0430\u043a \u0415\u0434\u0438\u043d\u0438\u0446\u0430 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u043d\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0441\u043f\u0440\u0430\u0432\u043e\u0447\u043d\u0438\u043a\u0443 \u043d\u0430 \u042d\u0422\u041f"); has_errors=true}if(!currentRow.countriesOfOrigin){errors.push("\u0421\u0442\u0440\u043e\u043a\u0430 \u2116 "+(i+3)+" \u043d\u0435 \u0431\u044b\u043b\u0430 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u0430, \u0442\u0430\u043a \u043a\u0430\u043a \u0421\u0442\u0440\u0430\u043d\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0442\u043e\u0432\u0430\u0440\u0430 \u043d\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0441\u043f\u0440\u0430\u0432\u043e\u0447\u043d\u0438\u043a\u0443 \u043d\u0430 \u042d\u0422\u041f"); has_errors=true}if(!currentRow.currency){errors.push("\u0421\u0442\u0440\u043e\u043a\u0430 \u2116 "+(i+3)+" \u043d\u0435 \u0431\u044b\u043b\u0430 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u0430, \u0442\u0430\u043a \u043a\u0430\u043a \u0412\u0430\u043b\u044e\u0442\u0430 \u043d\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0441\u043f\u0440\u0430\u0432\u043e\u0447\u043d\u0438\u043a\u0443 \u043d\u0430 \u042d\u0422\u041f");has_errors=true}if(!currentRow.type_object_purchase){errors.push("\u0421\u0442\u0440\u043e\u043a\u0430 \u2116 "+ (i+3)+" \u043d\u0435 \u0431\u044b\u043b\u0430 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u0430, \u0442\u0430\u043a \u043a\u0430\u043a \u0422\u0438\u043f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0437\u0430\u043a\u0443\u043f\u043a\u0438 \u043d\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0441\u043f\u0440\u0430\u0432\u043e\u0447\u043d\u0438\u043a\u0443 \u043d\u0430 \u042d\u0422\u041f");has_errors=true}var contractPosition=false;var contractPositionId= null;Ext.iterate(me.contractPositions,function(cp,j){if(currentRow.contractPositionName.toLowerCase()==cp.name.toLowerCase()&¤tRow.unitPrice==cp.unit_price){contractPosition=cp;contractPositionId=j+1}});if(!contractPosition){errors.push("\u0421\u0442\u0440\u043e\u043a\u0430 \u2116 "+(i+3)+" \u043d\u0435 \u0431\u044b\u043b\u0430 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u0430, \u0442\u0430\u043a \u043a\u0430\u043a \u043d\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u0438 \u043e\u0434\u043d\u043e\u043c\u0443 \u0438\u0437 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0439 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"); has_errors=true}else{currentRow.contractPosition_id=contractPositionId;currentRow.contractPosition=contractPosition}if(has_errors)return;currentRow.date=new Date(currentRow.date);var uniqueDocsStoreRecord=new uniqueDocsStore.recordType({"id":generateRandomUUID(),"date":currentRow.date,"name":currentRow.name,"number":currentRow.number});uniqueDocsStore.add(uniqueDocsStoreRecord);currentRow.id=generateRandomUUID();currentRow.ordinal=i+1;currentRow.doc_internal_uuid=uniqueDocsStoreRecord.get("id");var newRec= new destStore.recordType(currentRow);destStore.add(newRec)});if(errors.length)Ext.MessageBox.alert("\u041e\u0448\u0438\u0431\u043a\u0430",errors.join("
      "))};if(response.result&&response.result.data)doUpdate();window.close()}}}]});window.show()}},"->",{text:"\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c",id:saveButtonId,disabled:true,handler:function(){var sourceStore=win.contractExecutionGridRowAcceptanceDocsMultiPanel.destinationGrid.getStore();var parent=me.parentCmp.parentCmp.parentCmp.parentCmp; if(parent){var values=parent.infoPanel.getValues();var totalSum=0;sourceStore.each(function(record){totalSum+=me.calculateRubSum(record.data)});if(values.price&&totalSum>values.price){Ext.Msg.alert("\u041e\u0448\u0438\u0431\u043a\u0430","\u0421\u0443\u043c\u043c\u0430 \u043f\u043e \u043f\u043e\u0437\u0438\u0446\u0438\u044f\u043c \u0432\u0441\u0435\u0445 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0439 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0442\u044c \u0446\u0435\u043d\u0443 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430").setIcon(Ext.MessageBox.ERROR); return}}var destinationStore=me.store;sourceStore.each(function(row){var newRecord=new destinationStore.recordType(row.data);destinationStore.add(newRecord)});var sourceUniqueDocsStore=win.contractExecutionGridRowAcceptanceDocsMultiPanel.getUniqueDocsStore();var destinationUniqueDocsStore=me.uniqueDocsStore;sourceUniqueDocsStore.each(function(row){var newRecord=new destinationUniqueDocsStore.recordType(row.data);destinationUniqueDocsStore.add(newRecord)});win.close()}},{text:"\u041e\u0442\u043c\u0435\u043d\u0430", handler:function(){win.close()}}]});win.show()},refreshUniqueDocsStore:function(){var me=this;var uniqueDocsStore=me.uniqueDocsStore;var allDocsStore=me.store;if(!uniqueDocsStore||!allDocsStore)return;var isDocInStore=function(doc_id){var exist=false;allDocsStore.each(function(doc){if(doc.get("doc_internal_uuid")===doc_id)exist=true});return exist};uniqueDocsStore.each(function(rec){if(!isDocInStore(rec.get("id")))uniqueDocsStore.remove(rec)})},onStoreChanged:function(){var totalSum=0;var me=this; me.getStore().each(function(record){totalSum+=me.calculateRubSum(record.data)});var summary=Ext.getCmp(me.summaryId);if(summary)summary.setText("\u0421\u0443\u043c\u043c\u0430 \u0432\u0441\u0435\u0433\u043e, \u0440\u0443\u0431.: "+Ext.util.Format.formatPrice(totalSum)+" "+RUB_SIGN);me.refreshUniqueDocsStore()},getValues:function(){var me=this;var values=[];this.getStore().each(function(record){var data=record.data;data["doc_title"]=me.docTitleRenderer(null,null,record);values.push(data)});return values}, setValues:function(values){var store=this.getStore();store.loadData(values)},calculateRubSum:function(data){var currencyRate=data["currency"]===810||data["currency"]==="\u0420\u043e\u0441\u0441\u0438\u0439\u0441\u043a\u0438\u0439 \u0440\u0443\u0431\u043b\u044c"?1:data.exchangeRate;return data["unitPrice"]*(data["qty"]||1)*currencyRate},initComponent:function(){var me=this;me.summaryId=Ext.id();me.addEvents("editRecord","deleteRecord","addRow","storechanged");me.okeiStore=getOkeiStore();if(me.store){var storeChangedHandler= function(store,record,op){me.fireEvent("storechanged",store)};me.store.on("remove",storeChangedHandler);me.store.on("add",storeChangedHandler);me.store.on("load",storeChangedHandler);me.store.on("update",storeChangedHandler)}Ext.apply(me,{columns:me.getColumns(),viewConfig:{forceFit:true,autoFill:true,markDirty:false,deferEmptyText:false,emptyText:"\u041d\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0445"},bbar:[{id:me.summaryId,xtype:"tbtext",text:" "},"->",{cls:"x-btn-text-icon",icon:"ico/add.png", hidden:!!me.hideAddButton,text:"\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c",handler:function(){me.fireEvent("addRow")}}],listeners:{addRow:me.onAddRow,storechanged:me.onStoreChanged}});Application.components.ContractExecutionGridRowAcceptanceDocsGrid.superclass.initComponent.call(this)}});Ext.define("Application.components.ContractExecutionGridRowAcceptanceDocsMultiPanel",{extend:"Ext.panel.Panel",contractPositions:null,documentTypesStore:null,countriesStore:null,objectTypeStore:null,height:500,docsStore:null,uniqueDocsStore:null,getUniqueDocsStore:function(){return this.uniqueDocsStore},initComponent:function(){var me=this;me.addEvents("storechanged");Ext.apply(me,{layout:"border",buttonAlign:"left",items:[{region:"north",height:120,xtype:"Application.components.ContractExecutionGridRowAcceptanceDocsCommonForm", title:"\u041e\u0431\u0449\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435",documentTypesStore:me.documentTypesStore,parentCmp:me,ref:"commonForm"},{xtype:"Application.components.ContractExecutionGridRowAcceptanceDocsPositionsGrid",contractPositions:me.contractPositions,uniqueDocsStore:me.uniqueDocsStore,region:"west",title:"\u041f\u043e\u0437\u0438\u0446\u0438\u0438 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430",split:true,parentCmp:me,ref:"sourceGrid",width:400},{region:"center",xtype:"Application.components.ContractExecutionGridRowAcceptanceDocsGrid", parentCmp:me,title:"\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0445 \u043f\u0440\u0438\u0435\u043c\u043a\u0438",ref:"destinationGrid",documentTypesStore:me.documentTypesStore,objectTypeStore:me.objectTypeStore,contractPositions:me.contractPositions,countriesStore:me.countriesStore,uniqueDocsStore:me.uniqueDocsStore,hideAddButton:true,hideCountries:true,store:me.docsStore,split:true,isEmbeded:true,listeners:{storechanged:function(store){me.fireEvent("storechanged", store)}}}]});Application.components.ContractExecutionGridRowAcceptanceDocsMultiPanel.superclass.initComponent.call(this)}});Ext.define("Application.components.ContractExecutionGridRowAcceptanceDocsPositionsGrid",{extend:"Ext.grid.Panel",frame:true,border:false,plan_guid:null,contractPositions:null,parentCmp:null,uniqueDocsStore:null,createContractPositionsStore:function(){var me=this;var arrayData=me.contractPositions;Ext.iterate(arrayData,function(data,i){arrayData[i]["id"]=data["unit_name"]+"_"+data["unit_pos"]});return new Ext.data.JsonStore({autoDestroy:false,autoLoad:true,idProperty:"id",paramsAsHash:true,fields:["id", "checked","amountOfBudgetFunds","countriesOfOrigin","countryManufacturer","financialVolumePositionRub","targetCode","typeCode","type_object_purchase","unit_guid","unit_name","unit_okei","unit_okpd2","unit_pos","unit_price","unit_quantity","unit_currency"],data:arrayData})},getStore:function(){return this.createContractPositionsStore()},initComponent:function(){var me=this;var selectionModel=new Ext.grid.CheckboxSelectionModel({singleSelect:false,checkonly:true});me.store=me.getStore();me.addEvents("search", "addRow");Ext.apply(me,{sm:selectionModel,colModel:new Ext.grid.ColumnModel({columns:[selectionModel,{header:"\u041f\u043e\u0437\u0438\u0446\u0438\u044f",dataIndex:"unit_name",flex:1,sortable:true},{header:"\u0426\u0435\u043d\u0430 \u0437\u0430 \u043f\u043e\u0437\u0438\u0446\u0438\u044e",dataIndex:"unit_price",width:40,renderer:Ext.util.Format.formatPrice},{header:"\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e",dataIndex:"unit_quantity",width:40,hidden:true}]}),tbar:{xtype:"Application.components.searchToolbar", eventTarget:this,searchHelp:"\u0411\u044b\u0441\u0442\u0440\u044b\u0439 \u043f\u043e\u0438\u0441\u043a"},bbar:["->",{cls:"x-btn-text-icon",icon:"images/icons/silk/arrow_switch.png",text:"\u041f\u0435\u0440\u0435\u043d\u0435\u0441\u0442\u0438 \u0432 \u0441\u043f\u0438\u0441\u043e\u043a",handler:function(){me.fireEvent("addRow")}}],viewConfig:{forceFit:true,autoFill:true,markDirty:false,deferEmptyText:false,emptyText:"\u041d\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0445"},loadMask:true,listeners:{rowdblclick:function(grid, rowIndex){var record=me.store.getAt(rowIndex);record.set("checked",!record.get("checked"))},addRow:me.onAddRow,search:me.onSearch}});Application.components.ContractExecutionGridRowAcceptanceDocsPositionsGrid.superclass.initComponent.call(this)},onSearch:function(val){var me=this;if(isEmpty(val)){me.store.clearFilter();return}me.store.filter("unit_name",val,false,false)},isUniqueDocExists:function(docData){var me=this;var exists=false;me.uniqueDocsStore.each(function(doc){if(doc["data"]["name"]=== docData["name"]&&doc["data"]["date"].getTime()===docData["date"].getTime()&&doc["data"]["number"]===docData["doc_number"])exists=true});return exists},onAddRow:function(){var me=this;var rows=me.getSelectionModel().getSelections();if(isEmpty(rows))return;var baseData=me.parentCmp.commonForm.getValues();if(!baseData){alertError("\u0417\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043e\u0431\u0449\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043f\u0440\u0438\u0435\u043a\u0438"); return}if(me.isUniqueDocExists(baseData)){alertError("\u0414\u0430\u043d\u043d\u044b\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0432 \u0441\u043f\u0438\u0441\u043a\u0435");return}var destinationStore=me.parentCmp.destinationGrid.getStore();var uniqueDocsStoreRecord=new me.uniqueDocsStore.recordType({"id":generateRandomUUID(),"date":baseData.date,"name":baseData.name,"number":baseData.doc_number});me.uniqueDocsStore.add(uniqueDocsStoreRecord); Ext.iterate(rows,function(currentRow){var newRec=new destinationStore.recordType({"id":generateRandomUUID(),"ordinal":1,"date":baseData.date,"name":baseData.name,"number":baseData.doc_number,"doc_internal_uuid":uniqueDocsStoreRecord.get("id"),"type_object_purchase":currentRow.get("type_object_purchase"),"contractPosition_id":currentRow.get("id"),"contractPosition":currentRow.data,"okei":currentRow.get("unit_okei"),"qty":currentRow.get("unit_quantity"),"unitPrice":currentRow.get("unit_price"),"currency":currentRow.get("unit_currency"), "exchangeRate":"","exchangeRateDate":"","rubUnitPrice":"","countriesOfOrigin":currentRow.get("countriesOfOrigin"),"countryManufacturer":currentRow.get("countryManufacturer"),"prepayment":false,"totalRub":0});destinationStore.add(newRec)})}});Ext.define("Application.components.ContractExecutionGridRowAcceptancePanel",{extend:"Ext.panel.Panel",layout:"form",labelWidth:350,defaults:{anchor:"100%"},contractPositionsStore:null,autoSelectPosition:false,initComponent:function(){var me=this;Ext.apply(me,{items:[{xtype:"Application.components.combo",store:me.createDocumentTypesStore(),fieldLabel:"\u041d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430"+REQUIRED_FIELD,allowBlank:false, displayField:"name",valueField:"id",name:"document_name",editable:false,triggerAction:"all",forceSelection:true,mode:"local",renderer:function(record){return String.leftPad(record.id,2,"0")+" - "+record.name}},{xtype:"textfield",fieldLabel:"\u041d\u043e\u043c\u0435\u0440 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430"+REQUIRED_FIELD,allowBlank:false,name:"document_number"},{xtype:"Application.components.dateField",format:"d.m.Y",fieldLabel:"\u0414\u0430\u0442\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430", name:"document_date"},{xtype:"combo",fieldLabel:"\u041f\u043e\u0437\u0438\u0446\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"+REQUIRED_FIELD,allowBlank:false,name:"contract",ref:"contractCombo",displayField:"unit_name",valueField:"unit_name",editable:false,triggerAction:"all",forceSelection:true,mode:"local",store:me.contractPositionsStore,listeners:{select:function(cmp,record){var contractPosition=record;me.objectTypeCombo.setValue(contractPosition.get("type_object_purchase"));me.documentQuantityField.setValue(contractPosition.get("unit_quantity")); me.documentUnitField.setValue(contractPosition.get("unit_okei"));me.documentUnitPriceField.setValue(contractPosition.get("unit_price"));me.documentCurrencyCombo.setValue(contractPosition.get("unit_currency"))}}},{xtype:"combo",fieldLabel:"\u0422\u0438\u043f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0437\u0430\u043a\u0443\u043f\u043a\u0438"+REQUIRED_FIELD,allowBlank:false,store:me.createObjectTypeStore(),displayField:"name",valueField:"id",editable:false,triggerAction:"all",forceSelection:true, mode:"local",name:"object_type",ref:"objectTypeCombo"},{xtype:"textfield",fieldLabel:"\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e (\u043e\u0431\u044a\u0435\u043c) \u0442\u043e\u0432\u0430\u0440\u043e\u0432, \u0440\u0430\u0431\u043e\u0442, \u0443\u0441\u043b\u0443\u0433"+REQUIRED_FIELD,allowBlank:false,name:"document_quantity",ref:"documentQuantityField"},{xtype:"Application.components.okeiField",fieldLabel:"\u0415\u0434\u0438\u043d\u0438\u0446\u0430 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f"+ REQUIRED_FIELD,allowBlank:false,name:"document_unit",ref:"documentUnitField"},{xtype:"Application.components.priceField",fieldLabel:"\u0426\u0435\u043d\u0430 \u0437\u0430 \u0435\u0434\u0438\u043d\u0438\u0446\u0443",name:"document_unit_price",ref:"documentUnitPriceField",listeners:{change:function(cmp,value){if(me.documentCurrencyCombo.isVisible()&&me.currencyValueField.getValue()>0)me.subRubField.setValue(parseFloat(me.documentQuantityField.getValue())*parseFloat(value)*me.currencyValueField.getValue())}}}, {fieldLabel:"\u0412\u0430\u043b\u044e\u0442\u0430"+REQUIRED_FIELD,xtype:"Application.components.CurrencyCombo",name:"document_currency",ref:"documentCurrencyCombo",listeners:{select:function(cmp,record){me.currencyValueField.setVisible(!!record&&record.get("name")!=="RUB")}}},{xtype:"Application.components.priceField",fieldLabel:"\u041a\u0443\u0440\u0441 \u0432\u0430\u043b\u044e\u0442\u044b"+REQUIRED_FIELD,allowBlank:false,name:"document_currency_value",ref:"currencyValueField",listeners:{change:function(cmp, value){me.subRubField.setValue(parseFloat(me.documentQuantityField.getValue())*parseFloat(me.documentUnitPriceField.getValue())*value)}}},{xtype:"Application.components.priceField",fieldLabel:"\u0421\u0443\u043c\u043c\u0430 \u043e\u043f\u043b\u0430\u0442\u044b \u0432 \u0440\u0443\u0431\u043b\u0435\u0432\u043e\u043c \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u0435",name:"document_sum_rub",ref:"subRubField"},{xtype:"checkbox",name:"document_as_prepayment",fieldLabel:"\u041e\u043f\u043b\u0430\u0442\u0430 \u0430\u0432\u0430\u043d\u0441\u043e\u043c"}], listeners:{afterRender:me.onAfterRender}});Application.components.ContractExecutionGridRowAcceptancePanel.superclass.initComponent.call(this)},onAfterRender:function(){var me=this;if(me.autoSelectPosition!==true)return;var firstRecord=me.contractCombo.getStore().getAt(0);if(!firstRecord)return;me.contractCombo.setValue(firstRecord.get("unit_name"));me.contractCombo.fireEvent("select",me.contractCombo,firstRecord)},setValues:function(values){setComponentValues(this,values)},getValues:function(){var values= {};collectComponentValues(this,values);return values}});Ext.define("Application.components.ContractExecutionGridRowPanel",{extend:"Ext.Panel",border:false,frame:true,bodyCssClass:"subpanel",contractPositions:null,autoSelectPosition:false,documentTypesStore:null,objectTypeStore:null,countriesStore:null,currencyStore:null,uniqueDocsStore:null,docsStore:null,parentCmp:null,createDocumentTypesStore:function(){return new Ext.data.ArrayStore({id:0,fields:["id","name"],data:[[1,"\u0442\u043e\u0432\u0430\u0440\u043d\u0430\u044f \u043d\u0430\u043a\u043b\u0430\u0434\u043d\u0430\u044f"], [2,"\u0442\u043e\u0432\u0430\u0440\u043d\u043e-\u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u043d\u0430\u044f \u043d\u0430\u043a\u043b\u0430\u0434\u043d\u0430\u044f"],[3,"\u0436\u0435\u043b\u0435\u0437\u043d\u043e\u0434\u043e\u0440\u043e\u0436\u043d\u0430\u044f \u043d\u0430\u043a\u043b\u0430\u0434\u043d\u0430\u044f"],[4,"\u0430\u0432\u0438\u0430\u043d\u0430\u043a\u043b\u0430\u0434\u043d\u0430\u044f"],[5,"\u043a\u043e\u043d\u043e\u0441\u0430\u043c\u0435\u043d\u0442"],[6,"\u0430\u043a\u0442 \u043e \u043f\u0440\u0438\u0435\u043c\u043a\u0435 \u0442\u043e\u0432\u0430\u0440\u043e\u0432"], [7,"\u0430\u043a\u0442 \u043e \u043f\u0440\u0438\u0435\u043c\u043a\u0435 \u0442\u043e\u0432\u0430\u0440\u043e\u0432, \u043f\u043e\u0441\u0442\u0443\u043f\u0438\u0432\u0448\u0435\u0433\u043e \u0431\u0435\u0437 \u0441\u0447\u0435\u0442\u0430 \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u0430"],[8,"\u0430\u043a\u0442 \u043e \u043f\u0440\u0438\u0435\u043c\u043a\u0435-\u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0441\u0440\u0435\u0434\u0441\u0442\u0432 (\u043a\u0440\u043e\u043c\u0435 \u0437\u0434\u0430\u043d\u0438\u0439, \u0441\u043e\u043e\u0440\u0443\u0436\u0435\u043d\u0438\u0439)"], [9,"\u0430\u043a\u0442 \u043e \u043f\u0440\u0438\u0435\u043c\u043a\u0435-\u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 \u0437\u0434\u0430\u043d\u0438\u044f (\u0441\u043e\u043e\u0440\u0443\u0436\u0435\u043d\u0438\u044f)"],[10,"\u0430\u043a\u0442 \u043e \u043f\u0440\u0438\u0435\u043c\u043a\u0435-\u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 \u0433\u0440\u0443\u043f\u043f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0441\u0440\u0435\u0434\u0441\u0442\u0432 (\u043a\u0440\u043e\u043c\u0435 \u0437\u0434\u0430\u043d\u0438\u0439, \u0441\u043e\u043e\u0440\u0443\u0436\u0435\u043d\u0438\u0439)"], [11,"\u0430\u043a\u0442 \u043e \u043f\u0440\u0438\u0435\u043c\u0435-\u0441\u0434\u0430\u0447\u0435 \u043e\u0442\u0440\u0435\u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445, \u0440\u0435\u043a\u043e\u043d\u0441\u0442\u0440\u0443\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u0440\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0441\u0440\u0435\u0434\u0441\u0442\u0432"], [12,"\u0430\u043a\u0442 \u043e \u043f\u0440\u0438\u0435\u043c\u043a\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0445 \u0440\u0430\u0431\u043e\u0442"],[13,"\u0430\u043a\u0442 \u043f\u0440\u0438\u0435\u043c\u043a\u0435 \u0437\u0430\u043a\u043e\u043d\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u043e\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u0430"],[18,"\u0441\u0447\u0435\u0442 \u043d\u0430 \u043e\u043f\u043b\u0430\u0442\u0443"], [19,"\u0441\u0447\u0435\u0442-\u0444\u0430\u043a\u0442\u0443\u0440\u0430"],[20,"\u0430\u043a\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0445 \u0440\u0430\u0431\u043e\u0442"],[21,"\u0430\u043a\u0442 \u043e \u043f\u0440\u0438\u0435\u043c\u043a\u0435 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u043e\u0432"],[22,"\u0430\u043a\u0442 \u043e \u0437\u0430\u0432\u0435\u0441\u0435 \u0442\u0430\u0440\u044b"],[23,"\u0430\u043a\u0442 \u043e\u0431 \u043e\u043f\u0440\u0438\u0445\u043e\u0434\u043e\u0432\u0430\u043d\u0438\u0438 \u0442\u0430\u0440\u044b, \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0439 \u0432 \u0441\u0447\u0435\u0442\u0435 \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u0430"], [24,"\u0430\u043a\u0442 \u043e \u0432\u044b\u044f\u0432\u043b\u0435\u043d\u0438\u0438 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0445 \u0440\u0430\u0431\u043e\u0442 (\u043e\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0445 \u0443\u0441\u043b\u0443\u0433)"],[25,"\u0430\u043a\u0442 \u043e \u043d\u0435\u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0440\u0430\u0431\u043e\u0442 (\u043e\u043a\u0430\u0437\u0430\u043d\u0438\u0438 \u0443\u0441\u043b\u0443\u0433)"], [26,"\u0430\u043a\u0442 - \u0440\u0435\u043a\u043b\u0430\u043c\u0430\u0446\u0438\u044f"],[31,"\u0430\u043a\u0442 \u043e \u043f\u0440\u0438\u0435\u043c\u0435 (\u043f\u043e\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0438) \u043e\u0431\u043e\u0440\u0443\u0434\u043e\u0432\u0430\u043d\u0438\u044f"],[37,"\u043f\u0440\u043e\u0447\u0438\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b \u043e \u043f\u0440\u0438\u0435\u043c\u043a\u0435"]]})},createDocsStore:function(){var me=this;return new Ext.data.JsonStore({autoDestroy:true, autoLoad:true,idProperty:"id",paramsAsHash:true,fields:["id","ordinal","date","code","name","number","doc_internal_uuid","type_object_purchase","contractPosition_id","contractPosition","okei","qty","unitPrice","currency","exchangeRate","countriesOfOrigin","countryManufacturer","exchangeRateDate","rubUnitPrice","prepayment","totalRub"],data:[]})},createObjectTypeStore:function(){return Application.models.Procedure.getTypeObjectPurchaseStore()},createUniqueDocsStore:function(){return new Ext.data.JsonStore({autoDestroy:true, autoLoad:true,idProperty:"id",paramsAsHash:true,fields:["id","name","number","date","title"],data:[]})},setValues:function(values){this.contractExecutionGridRowPaymentsPanel.setValues(values);this.contractExecutionGridRowPaymentPanel.setValues(values);if(!isEmpty(values["uniqueDocs"]))this.uniqueDocsStore.loadData(values["uniqueDocs"])},getTitleRenderer:function(record){var me=this;var name=record.get("name")?me.documentTypesStore.getById(record.get("name")).get("name"):"";var number=record.get("number"); var date=record.get("date");return name+" \u2116"+number+", \u043e\u0442 "+(date?humanizeDate(date):"")},getUniqueDocsData:function(){var data=[];var me=this;me.uniqueDocsStore.each(function(record){record.data.title=me.getTitleRenderer(record);data.push(record.data)});return data},getValues:function(){var values={};values=Ext.apply(values,this.contractExecutionGridRowPaymentsPanel.getValues());values=Ext.apply(values,this.contractExecutionGridRowPaymentPanel.getValues());values["uniqueDocs"]=this.getUniqueDocsData(); return values},createPaymentInfosStore:function(){return new Ext.data.JsonStore({autoDestroy:true,autoLoad:true,idProperty:"id",paramsAsHash:true,fields:["id","contractAcceptanceDocs","paymentDate","price","currency","currencyRate","rubPrice","prepaid"],data:[]})},initChangeEvents:function(){var me=this;var datachangedHandler=function(){me.fireEvent("datachanged",me.docsStore,me.paymentInfosStore)};me.docsStore.on("add",datachangedHandler);me.docsStore.on("remove",datachangedHandler);me.docsStore.on("load", datachangedHandler);me.paymentInfosStore.on("add",datachangedHandler);me.paymentInfosStore.on("remove",datachangedHandler);me.paymentInfosStore.on("load",datachangedHandler)},initComponent:function(){var me=this;me.documentTypesStore=me.createDocumentTypesStore();me.objectTypeStore=me.createObjectTypeStore();me.uniqueDocsStore=me.createUniqueDocsStore();me.docsStore=me.createDocsStore();me.paymentInfosStore=me.createPaymentInfosStore();me.addEvents("datachanged");me.initChangeEvents();Ext.apply(me, {defaults:{anchor:"100%"},layout:{type:"vbox",padding:"0",align:"stretch"},padding:"5px",items:[{xtype:"Application.components.FormFieldsetContainer",ref:"contractExecutionGridRowPaymentsPanel",title:"\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0445 \u043f\u0440\u0438\u0435\u043c\u043a\u0438",flex:1,layout:"fit",items:[{xtype:"Application.components.ContractExecutionGridRowAcceptanceDocsGrid",name:"acceptanceDocs",parentCmp:me, documentTypesStore:me.documentTypesStore,autoSelectPosition:me.autoSelectPosition,contractPositions:me.contractPositions,objectTypeStore:me.objectTypeStore,currencyStore:me.currencyStore,countriesStore:me.countriesStore,store:me.docsStore,uniqueDocsStore:me.uniqueDocsStore,parentCmp:me,height:200}]},{xtype:"Application.components.FormFieldsetContainer",ref:"contractExecutionGridRowPaymentPanel",title:"\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e\u0431 \u043e\u043f\u043b\u0430\u0442\u0435", layout:"fit",flex:1,items:[{xtype:"Application.components.ContractExecutionGridRowPaymentsGrid",ref:"../contractExecutionGridRowPaymentsGrid",parentCmp:me,name:"paymentsInfo",store:me.paymentInfosStore,currencyStore:me.currencyStore,height:200}]}]});Application.components.ContractExecutionGridRowPanel.superclass.initComponent.call(this)}});Ext.define("Application.components.ContractExecutionGridRowPaymentsGrid",{extend:"Ext.grid.EditorGridPanel",editable:true,border:true,plugins:[Ext.ux.plugins.GridRowEditor],contractPositionsStore:null,currencyStore:null,summaryId:null,getAcceptanceDocs:function(){var docs=this.parentCmp.getUniqueDocsData();return docs||[]},getAcceptanceDocsStore:function(){var me=this;return new Ext.data.JsonStore({fields:["id","title"],idIndex:0,data:me.getAcceptanceDocs()})},getAcceptanceDocsStoreForCombo:function(){var me= this;var docs=me.getAcceptanceDocs();if(docs.length)docs.unshift({"id":0,"title":"\u0412\u0441\u0435"});return new Ext.data.JsonStore({fields:["id","title"],idIndex:0,data:docs})},currencyRenderer:function(value,meta,record){var me=this;var rec=me.currencyStore.getById(value);return rec?rec.get("description"):""},getEditor:function(form,isInsertingMode){var me=this;var calculateRubSum=function(){var price=form.priceField.getValue()||0;var rate=form.exchangeRateField.getValue()||1;form.totalRubField.setValue(price* rate)};var docsStore=me.getAcceptanceDocsStoreForCombo();return[{xtype:"checkboxcombo",name:"contractAcceptanceDocs",multiSelect:true,disabled:docsStore.getCount()<1,store:docsStore,valueField:"id",displayField:"title",mode:"local",value:false,editable:false,allowBlank:false,fieldLabel:"\u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u043f\u043b\u0430\u0442\u0435\u0436\u043d\u043e\u0433\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u043c \u043e \u043f\u0440\u0438\u0435\u043c\u043a\u0435"+ REQUIRED_FIELD,getValue:function(){var value=Ext.ux.form.CheckboxCombo.prototype.getValue.call(this);if(!value)return value;var values=value.split(",");if(values[0]=="0")values.shift();return values.join(",")},listeners:{change:function(element,values){var records=this.store.getRange();if(values.length){var first_value=values[0];var old_values=this.value;old_values=old_values.split(",");var new_ids=[];if(!first_value.name)if(values.length!==records.length&&old_values[0]!="0"){Ext.each(records,function(value){new_ids.push(value.id)}); this.setValue(new_ids)}else{if(values.length==1)this.setValue([])}else if(old_values&&old_values.length&&old_values[0]=="0")this.setValue([])}},changed:function(element,values){if(values.length&&values[0]=="0"){var current_value=this.value;this.lastSelectionText=this.lastSelectionText.split(", ").slice(1).join(", ");Ext.ux.form.CheckboxCombo.superclass.setValue.call(this,this.lastSelectionText);this.value=current_value}}}},{xtype:"datefield",name:"paymentDate",allowBlank:false,fieldLabel:"\u0414\u0430\u0442\u0430 \u043e\u043f\u043b\u0430\u0442\u044b"+ REQUIRED_FIELD},{xtype:"Application.components.priceField",ref:"priceField",allowBlank:false,name:"price",fieldLabel:"\u0421\u0443\u043c\u043c\u0430 \u043e\u043f\u043b\u0430\u0442\u044b"+REQUIRED_FIELD,listeners:{change:function(cmp,newValue){calculateRubSum()}}},{name:"currency",xtype:"Application.components.CurrencyCombo",store:me.currencyStore,allowBlank:false,fieldLabel:"\u0412\u0430\u043b\u044e\u0442\u0430"+REQUIRED_FIELD,listeners:{select:function(cmp,record){form.exchangeRateField.setVisible(record.get("id")!== 810)}}},{name:"currencyRate",xtype:"Application.components.priceField",ref:"exchangeRateField",fieldLabel:"\u041a\u0443\u0440\u0441 \u0432\u0430\u043b\u044e\u0442\u044b, \u0440\u0443\u0431.",hidden:true,value:1,listeners:{change:function(cmp,newValue){calculateRubSum()}}},{name:"rubPrice",xtype:"Application.components.priceField",ref:"totalRubField",fieldLabel:"\u0421\u0443\u043c\u043c\u0430 \u043e\u043f\u043b\u0430\u0442\u044b \u0432 \u0440\u0443\u0431\u043b\u0435\u0432\u043e\u043c \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u0435", disabled:true},{xtype:"checkbox",name:"prepaid",fieldLabel:"\u0410\u0432\u0430\u043d\u0441\u043e\u0432\u044b\u0439 \u043f\u043b\u0430\u0442\u0435\u0436"}]},calculateRubSum:function(data){var currencyRate=data["currency"]===810?1:data.currencyRate;return data["price"]*currencyRate},getColumns:function(){var me=this;return[new Ext.grid.RowNumberer({width:20}),{header:"\u0414\u0430\u0442\u0430 \u043e\u043f\u043b\u0430\u0442\u044b",dataIndex:"paymentDate",renderer:Ext.util.Format.dateRenderer("d.m.Y")}, {header:"\u041f\u043b\u0430\u0442\u0435\u0436\u043d\u044b\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b",dataIndex:"contractAcceptanceDocs",renderer:function(value,meta,record){var store=me.getAcceptanceDocsStore();var docTitlesArray=[];var valuesArray=!isEmpty(value)?value.split(","):[];Ext.iterate(valuesArray,function(valItem){docTitlesArray.push(store.getById(valItem).get("title"))});return!isEmpty(docTitlesArray)?docTitlesArray.join(", "):"\u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u044b"}}, {header:"\u0421\u0443\u043c\u043c\u0430 \u043e\u043f\u043b\u0430\u0442\u044b",dataIndex:"price",editable:true,editor:Ext.ux.helpers.textEdit(),renderer:function(value){return!isEmpty(value)?Ext.util.Format.formatPrice(value):""}},{header:"\u0412\u0430\u043b\u044e\u0442\u0430",dataIndex:"currency",scope:me,renderer:me.currencyRenderer},{header:"\u041a\u0443\u0440\u0441 \u0432\u0430\u043b\u044e\u0442\u044b",dataIndex:"currencyRate",editable:true,editor:Ext.ux.helpers.textEdit(),renderer:function(value, meta,record){return!isEmpty(value)&&record.get("currency")!==810?Ext.util.Format.formatPrice(value):"-"}},{header:"\u0421\u0443\u043c\u043c\u0430 \u043e\u043f\u043b\u0430\u0442\u044b \u0432 \u0440\u0443\u0431.",dataIndex:"rubPrice",renderer:function(value,meta,record){return Ext.util.Format.formatPrice(me.calculateRubSum(record.data))+" "+RUB_SIGN}},{header:"\u0410\u0432\u0430\u043d\u0441\u043e\u0432\u044b\u0439 \u043f\u043b\u0430\u0442\u0435\u0436",dataIndex:"prepaid",renderer:function(value,meta, record){return value?"\u0414\u0430":"\u041d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043e"}},{header:"\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u0438",xtype:"textactioncolumn",actionsSeparator:" ",width:50,items:[{tooltip:"\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c",icon:"/ico/edit.png",text:"",handler:function(grid,rowIndex){me.fireEvent("rowediting",rowIndex)}},{tooltip:"\u0423\u0434\u0430\u043b\u0438\u0442\u044c",icon:"/ico/delete.png",text:"",handler:function(grid, rowIndex){grid.getStore().removeAt(rowIndex);grid.view.refresh()}}]}]},getValues:function(){var me=this;var values=[];this.getStore().each(function(record){var data=record.data;values.push(data)});return values},setValues:function(values){var store=this.getStore();store.loadData(values)},isDocumentInGridRows:function(documentUuid){var me=this;var exists=false;me.getStore().each(function(record){var recordDocs=record.get("contractAcceptanceDocs");if(!isEmpty(recordDocs)){var recordDocsArray=recordDocs.split(","); if(in_array(documentUuid,recordDocsArray))exists=true}});return exists},onStoreChanged:function(){var totalSum=0;var me=this;me.getStore().each(function(record){totalSum+=me.calculateRubSum(record.data)});var summary=Ext.getCmp(me.summaryId);if(summary)summary.setText("\u0421\u0443\u043c\u043c\u0430 \u0432\u0441\u0435\u0433\u043e, \u0440\u0443\u0431.: "+Ext.util.Format.formatPrice(totalSum)+" "+RUB_SIGN)},initComponent:function(){var me=this;me.addEvents("editRecord","deleteRecord","storechanged"); me.summaryId=Ext.id();if(me.store){var storeChangedHandler=function(store,record,op){me.fireEvent("storechanged",store)};me.store.on("remove",storeChangedHandler);me.store.on("add",storeChangedHandler);me.store.on("load",storeChangedHandler);me.store.on("update",storeChangedHandler)}Ext.apply(me,{columns:me.getColumns(),viewConfig:{forceFit:true,autoFill:true,markDirty:false,deferEmptyText:false,emptyText:"\u041d\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0445"},listeners:{storechanged:me.onStoreChanged}, bbar:[{id:me.summaryId,xtype:"tbtext"},"->",{cls:"x-btn-text-icon",icon:"ico/add.png",text:"\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c",handler:function(){var store=me.getStore();var newRecord=new store.recordType({currency:810,currencyRate:1});me.fireEvent("rowediting",null,newRecord)}}]});Application.components.ContractExecutionGridRowPaymentsGrid.superclass.initComponent.call(this)}});Ext.define("Application.components.ContractExecutionGridRowPaymentsPanel",{extend:"Ext.panel.Panel",layout:"form",labelWidth:350,defaults:{anchor:"100%"},initComponent:function(){var me=this;Ext.apply(me,{items:[{xtype:"Application.components.dateField",format:"d.m.Y",fieldLabel:"\u0414\u0430\u0442\u0430 \u043e\u043f\u043b\u0430\u0442\u044b"+REQUIRED_FIELD,allowBlank:false,name:"payment_date"},{xtype:"Application.components.priceField",fieldLabel:"\u0421\u0443\u043c\u043c\u0430 \u043e\u043f\u043b\u0430\u0442\u044b"+ REQUIRED_FIELD,allowBlank:false,ref:"sumField",name:"payment_sum",listeners:{change:function(cmp,value){if(me.currencyField.isVisible()&&me.currencyValueField.getValue()>0)me.subRubField.setValue(parseFloat(value)*me.currencyValueField.getValue())}}},{fieldLabel:"\u0412\u0430\u043b\u044e\u0442\u0430"+REQUIRED_FIELD,xtype:"Application.components.CurrencyCombo",name:"payment_currency",ref:"currencyField",listeners:{select:function(cmp,record){me.currencyValueField.setVisible(!!record&&record.get("name")!== "RUB")}}},{xtype:"Application.components.priceField",fieldLabel:"\u041a\u0443\u0440\u0441 \u0432\u0430\u043b\u044e\u0442\u044b"+REQUIRED_FIELD,allowBlank:false,name:"payment_currency_value",ref:"currencyValueField",listeners:{change:function(cmp,value){me.subRubField.setValue(parseFloat(value)*me.sumField.getValue())}}},{xtype:"Application.components.priceField",fieldLabel:"\u0421\u0443\u043c\u043c\u0430 \u043e\u043f\u043b\u0430\u0442\u044b \u0432 \u0440\u0443\u0431\u043b\u0435\u0432\u043e\u043c \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u0435", ref:"subRubField",name:"payment_sum_rub"},{xtype:"checkbox",name:"payment_is_prepayment",fieldLabel:"\u0410\u0432\u0430\u043d\u0441\u043e\u0432\u044b\u0439 \u043f\u043b\u0430\u0442\u0435\u0436"}]});Application.components.ContractExecutionGridRowPaymentsPanel.superclass.initComponent.call(this)},setValues:function(values){setComponentValues(this,values)},getValues:function(){var values={};collectComponentValues(this,values);return values}});Ext.define("Application.components.ContractExecutionGridView",{extend:"Ext.grid.GridView",groupTextTpl:"\u042d\u0442\u043e \u0433\u0440\u0443\u043f\u043f\u0430",refreshRow:function(record){if(this.ds.getCount()==1)this.refresh();else{this.isUpdating=true;Ext.grid.GroupingView.superclass.refreshRow.apply(this,arguments);this.isUpdating=false}},initTemplates:function(){Ext.grid.GroupingView.superclass.initTemplates.call(this);this.state={};var sm=this.grid.getSelectionModel();sm.on(sm.selectRow?"beforerowselect": "beforecellselect",this.onBeforeRowSelect,this);if(!this.startGroup)this.startGroup=new Ext.XTemplate('
      ','
      ',this.groupTextTpl,"
      ",'
      ');this.startGroup.compile();if(!this.endGroup)this.endGroup="
      "},doGroupStart:function(buf,g,cs,ds,colCount){buf[buf.length]=this.startGroup.apply(g)},doGroupEnd:function(buf, g,cs,ds,colCount){buf[buf.length]=this.endGroup},doRender:function(columns,records,store,startRow,colCount,stripe){var me=this;var templates=this.templates,cellTemplate=templates.cell,rowTemplate=templates.row,last=colCount-1,tstyle="width:"+this.getTotalWidth()+";",rowBuffer=[],colBuffer=[],rowParams={tstyle:tstyle},meta={},len=records.length,alt,column,record,i,j,rowIndex;for(j=0;j1);me.contractChangesPanel.setDisabled(me.oos_version===1)})}});Ext.define("Application.components.ContractOosExecutionPublishForm",{extend:"Application.components.ContractExecutionPublishForm",initComponent:function(){Application.components.ContractOosExecutionPublishForm.superclass.initComponent.call(this)},updateInfoPanel:function(){var me=this;if(isEmpty(me.data.lastPublishedContract))return;me.infoPanel.setValues({registry_number:me.data.lastPublishedContract["name"]||"",oos_registry_number:me.data.lastPublishedContract["contractRegNumber"]||"",date:me.data.lastPublishedContract["contractDate"], subject:me.data.lastPublishedContract["subjectContract"]||"",price:me.data.lastPublishedContract["price"]||""})},loadContractPositions:function(){var me=this;if(isEmpty(me.data.lastPublishedContract)||!me.data.lastPublishedContract["contractPositions"])positions=[];else{positions=me.data.lastPublishedContract["contractPositions"];if(positions["contractPosition"]&&!Array.isArray(positions["contractPosition"]))positions=[positions["contractPosition"]];else if(Array.isArray(positions["contractPosition"]))positions= positions["contractPosition"];Ext.iterate(positions,function(position,i){if(positions[i]["currency"])positions[i]["unit_currency"]=positions[i]["currency"]?positions[i]["currency"]["name"]:"";else positions[i]["unit_currency"]=me.data.lastPublishedContract["currency"]?me.data.lastPublishedContract["currency"]["name"]:"";positions[i]["type_object_purchase"]=positions[i]["typeObjectPurchase"];positions[i]["unit_quantity"]=positions[i]["qty"]?positions[i]["qty"]:1;positions[i]["unit_okei"]=positions[i]["okei"]? positions[i]["okei"]["code"]:"";positions[i]["unit_okpd2"]=positions[i]["okpd2"]?positions[i]["okpd2"]["code"]:"";positions[i]["unit_price"]=positions[i]["unitPrice"]?positions[i]["unitPrice"]:0;positions[i]["unit_name"]=positions[i]["name"];positions[i]["unit_pos"]=positions[i]["ordinalNumber"];positions[i]["unit_guid"]=positions[i]["guid"];if(positions[i]["countriesOfOrigin"]){if(positions[i]["countriesOfOrigin"]["country"])positions[i]["countriesOfOrigin"]=positions[i]["countriesOfOrigin"]["country"]["digitalCode"]}else positions[i]["countriesOfOrigin"]= null;if(positions[i]["countryManufacturer"]){if(positions[i]["countryManufacturer"]["country"])positions[i]["countryManufacturer"]=positions[i]["countryManufacturer"]["country"]["digitalCode"]}else positions[i]["countryManufacturer"]=null;if(!positions[i]["totalRub"])positions[i]["totalRub"]=positions[i]["unit_quantity"]*positions[i]["unit_price"]})}me.executionGrid.loadContractPositions(positions)},validateForm:function(formValues){if(isEmpty(formValues["files"])||isEmpty(formValues["files"]["file"])){alertError("\u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u043f\u0440\u0438\u043a\u0440\u0435\u043f\u0438\u0442\u0435 \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u043e\u0434\u0438\u043d \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u0439 \u043e\u0431 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"); return false}return true},onSubmitForm:function(sent_to_oos){var me=this;sent_to_oos=sent_to_oos||false;if(!me.validateForm(me.getValues()))return false;var values={id:me["oos_contract_id"],sent_to_oos:!!sent_to_oos,oos_contract:true,contract_id:me["contract_id"],version:me["oos_version"],message_type:0,data:me.getValues()};performRPCCall(RPC.Contract.oosqueue,[values],{wait_delay:0,wait_text:sent_to_oos?"\u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f c\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e\u0431 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u043d\u0430 zakupki.gov.ru": "\u0414\u0430\u043d\u043d\u044b\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442\u0441\u044f"},function(result){echoResponseMessage(result);if(!!result)me.oos_contract_id=result.id})},onAfterrender:function(){var me=this;me.oos_contract_id=me.cmpdata["oos_contract_id"];me.oos_version=1;me.data.lastPublishedContract=me.cmpdata["message_body"];me.data.contract_data=me.cmpdata["saved_data"]||{"acceptanceInfo":{}};me.data.contract_data["acceptanceInfo"]["oos_version"]=me.oos_version;performRPCCall(RPC.Contract.oosdata, [{contract_id:me.contract_id,message_type:0}],{wait_delay:0,wait_text:"\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u044e\u0442\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u0435 "+t("\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430")+". \u041f\u043e\u0434\u043e\u0436\u0434\u0438\u0442\u0435..."},function(result){if(result["oos_contract_id"]){me.oos_contract_id=result["oos_contract_id"];me.oos_version=result["oos_info"]["version"]||1;me.data.contract_data["acceptanceInfo"]["oos_version"]=me.oos_version; me.data.files=result["files"]}me.updateInfoPanel();me.loadContractPositions();me.loadAcceptanceInfo();me.loadStores();me.contractChangesPanel.setVisible(me.oos_version>1);me.contractChangesPanel.setDisabled(me.oos_version===1)})}});Ext.define("Application.components.Contract2AdditionalContractTabPanel",{extend:"Application.components.Contract2ContractBaseTabPanel",parentCmp:null,title:"\u0414\u043e\u043f. \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435",baseTitle:"\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435",uploadButtonTitle:"\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0434\u043e\u043f. \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435", tabIndex:null,getAdditionalPanels:function(){var me=this;var items=[];items.push({xtype:"Application.components.ContractTypedFilesPanel",files:filterFiles(me.files,{type_id:Application.models.Contract.FILE_TYPE.customer_other}),title:"\u041f\u0440\u043e\u0447\u0438\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u0430",showInfopanel:true,fileTypeId:Application.models.Contract.FILE_TYPE.customer_other,discrepancyFileTypeId:null,showInfopanel:false, hiddenEmpty:true,signStrategy:[],currentCustomer:me.currentCustomer,currentSupplier:me.currentSupplier,currentOrganizer:me.currentOrganizer,uploadContragentType:"customer",signRpcMethod:me.signRpcMethod,fileHashRpcMethod:me.fileHashRpcMethod,suppliers:me.suppliers,lotInfo:me.lotInfo,actualMode:me.actualMode,enableDeleteLastVersion:true,uploadButtonTitle:"\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442",tabIndex:me.tabIndex});items.push({xtype:"Application.components.ContractTypedFilesPanel", files:filterFiles(me.files,{type_id:Application.models.Contract.FILE_TYPE.supplier_other}),title:"\u041f\u0440\u043e\u0447\u0438\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044f",showInfopanel:false,hiddenEmpty:true,fileTypeId:Application.models.Contract.FILE_TYPE.supplier_other,discrepancyFileTypeId:null,signStrategy:[],currentCustomer:me.currentCustomer,currentSupplier:me.currentSupplier,currentOrganizer:me.currentOrganizer,uploadContragentType:"supplier", signRpcMethod:me.signRpcMethod,fileHashRpcMethod:me.fileHashRpcMethod,suppliers:me.suppliers,lotInfo:me.lotInfo,actualMode:me.actualMode,enableDeleteLastVersion:true,uploadButtonTitle:"\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442",tabIndex:me.tabIndex});if(Main.user.eds_type==EDS_TYPE_PERSONAL&&me.isActualSupplier()&&me.isUserActualSupplier()||me.lotInfo.add_digitalpoas&&me.lotInfo.add_digitalpoas[me.tabIndex]){var signed=false;if(me.files.length)Ext.each(me.files, function(file){if(me.fileTypeId==file.type_id&&file.mainSupplierSigned)signed=true});items.push({xtype:"Application.components.DigitalPoaSelectFieldset",editable:true,name:"user_digitalpoa_id",value:me.lotInfo.add_digitalpoas[me.tabIndex]||null,hideDeleteButton:signed||!me.isActualSupplier()||!me.isUserActualSupplier(),listeners:{render:function(){if(this.value)this.fireEvent("selected",this,this.value,true);else me.disableSignButton()},clear:function(){performRPCCall(RPC.Lot.savePoa,[{id:me.lotInfo.id, tab:me.tabIndex,remove_user_digitalpoa:this.value}],[],function(resp){if(!resp.success)return});me.disableSignButton()},selected:function(cmp,id,dont_save){if(!dont_save)performRPCCall(RPC.Lot.savePoa,[{id:me.lotInfo.id,user_digitalpoa:id,tab:me.tabIndex}],[],function(resp){if(!resp.success)return});me.enableSignButton()}}})}return items},initComponent:function(){var me=this;var contract=this.files.length?this.files[this.files.length-1]:{};me.contractHeader={xtype:"Application.components.ContractNumberPanel", contractInfo:contract,fieldLabel:"\u041d\u043e\u043c\u0435\u0440 \u0414\u0421",msgText:"\u0423\u043a\u0430\u0436\u0438\u0442\u0435 \u043d\u043e\u043c\u0435\u0440 \u0414\u0421",value:contract["registration_number"],editable:contract["customer_id"]==Main.contragent.id};Application.components.Contract2AdditionalContractTabPanel.superclass.initComponent.call(this)}});Ext.define("Application.components.Contract2ContractBaseTabPanel",{extend:"Ext.panel.Panel",fileTypeId:null,discrepancyFileTypeId:null,files:null,signStrategy:["supplier","customer"],currentCustomer:null,currentSupplier:null,currentOrganizer:null,uploadContragentType:"customer",signRpcMethod:null,fileHashRpcMethod:null,suppliers:null,lotInfo:null,baseTitle:null,actualMode:null,tabIndex:null,uploadButtonTitle:"\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0434\u043e\u0433\u043e\u0432\u043e\u0440", notActualSupplierText:"\u0414\u043e\u0433\u043e\u0432\u043e\u0440 \u0441 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u043c \u043d\u0435 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f",padding:5,frame:true,locked:false,autoHeight:true,contractSignMode:null,contractHeader:false,customerEdsInfo:null,contractPanelId:Ext.id(),getNotActualSupplierPanel:function(){return{xtype:"fieldset",layout:"column",style:"padding: 5px; margin: 5px 0 0 0;",items:[{xtype:"panel",columnWidth:1, html:'
      '+this.notActualSupplierText+"
      "}]}},isActualSupplier:function(){return this.currentSupplier===this.lotInfo["contract_supplier_id"]||in_array(this.currentSupplier,this.lotInfo["selected_contract_supplier_ids"]||[])},isUserActualSupplier:function(){return Main.contragent.id===this.lotInfo["contract_supplier_id"]||in_array(Main.contragent.id,this.lotInfo["selected_contract_supplier_ids"]||[])},isActualCustomer:function(){return this.currentCustomer=== Main.contragent.id},isPossibleContragent:function(){var me=this;var anyContragents=[];anyContragents.push(me.currentCustomer);anyContragents.push(me.currentSupplier);anyContragents.push(me.currentOrganizer);if(me.suppliers)Ext.iterate(me.suppliers,function(supplier){anyContragents.push(supplier["id"])});return in_array(Main.contragent.id,anyContragents)},disableSignButton:function(){Ext.each(this.items.items,function(c){if(c&&c.isXType("Application.components.ContractTypedFilesPanel"))c.disableSignButton()})}, enableSignButton:function(){Ext.each(this.items.items,function(c){if(c&&c.isXType("Application.components.ContractTypedFilesPanel"))c.enableSignButton()})},getDigitalContractPanel:function(){var me=this;var contractFiles=filterFiles(me.files,{type_id:me.fileTypeId});return{xtype:"Application.components.ContractTypedFilesPanel",files:contractFiles,id:me.contractPanelId,enableDeleteLastVersion:true,title:me.baseTitle,showInfopanel:true,fileTypeId:me.fileTypeId,signStrategy:me.signStrategy,currentCustomer:me.currentCustomer, currentSupplier:me.currentSupplier,currentOrganizer:me.currentOrganizer,uploadContragentType:me.uploadContragentType,signRpcMethod:me.signRpcMethod,fileHashRpcMethod:me.fileHashRpcMethod,suppliers:me.suppliers,lotInfo:me.lotInfo,actualMode:me.actualMode,uploadButtonTitle:me.uploadButtonTitle,locked:!!me.locked,tabIndex:me.tabIndex,checkSignPossibility:true,viewCancelled:me.isPossibleContragent(),addHeader:me.contractHeader}},getPaperContractPanel:function(){var me=this;var contractFiles=filterFiles(me.files, {type_id:me.fileTypeId});return{xtype:"Application.components.Contract2PaperContractFilesPanel",files:contractFiles,enableDeleteLastVersion:true,title:me.baseTitle,showInfopanel:true,fileTypeId:me.fileTypeId,signStrategy:["customer"],currentCustomer:me.currentCustomer,currentSupplier:me.currentSupplier,currentOrganizer:me.currentOrganizer,uploadContragentType:"customer",customerEdsInfo:me.customerEdsInfo,signRpcMethod:RPC.Lot.signConfirm,fileHashRpcMethod:me.fileHashRpcMethod,suppliers:me.suppliers, lotInfo:me.lotInfo,actualMode:me.actualMode,uploadButtonTitle:"\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043e\u0442\u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0434\u043e\u0433\u043e\u0432\u043e\u0440",signButtonTitle:"\u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044c \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430", locked:me.actualMode==="View",tabIndex:me.tabIndex,checkSignPossibility:true,viewCancelled:me.isPossibleContragent(),addHeader:me.contractHeader}},isActualFileSigned:function(files){var result=false;Ext.iterate(files,function(file){if(!file.is_last_version)return true;if(file["customerSigned"])result=true;if(file["supplierSigned"])result=true});return result},getContractPanel:function(){var me=this;var contractFiles=filterFiles(me.files,{type_id:me.fileTypeId});var contractPanel=null;switch(me.contractSignMode){case CONTRACT_SIGN_DIGITAL:contractPanel= me.getDigitalContractPanel();break;case CONTRACT_SIGN_PAPER:contractPanel=me.getPaperContractPanel();break}return[contractPanel,{xtype:"Application.components.ContractTypedFilesPanel",files:filterFiles(me.files,{type_id:me.discrepancyFileTypeId}),enableDeleteLastVersion:true,title:"\u041f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u0440\u0430\u0437\u043d\u043e\u0433\u043b\u0430\u0441\u0438\u0439",showInfopanel:false,fileTypeId:me.discrepancyFileTypeId,signStrategy:["supplier"],currentCustomer:me.currentCustomer, currentSupplier:me.currentSupplier,currentOrganizer:me.currentOrganizer,uploadContragentType:"supplier",signRpcMethod:RPC.Contract.actualLastVersion,fileHashRpcMethod:me.fileHashRpcMethod,suppliers:me.suppliers,lotInfo:me.lotInfo,hiddenEmpty:true,actualMode:me.actualMode,uploadButtonTitle:"\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b",locked:me.locked||me.isActualFileSigned(contractFiles),hidden:(isEmpty(contractFiles)||me.contractSignMode!= CONTRACT_SIGN_DIGITAL)&&!me.isActualFileSigned(filterFiles(me.files,{type_id:me.discrepancyFileTypeId})),tabIndex:me.tabIndex,checkSignPossibility:true}]},getAdditionalPanels:function(){return{}},initComponent:function(){var me=this;me.contractPanelId=Ext.id();Ext.apply(me,{items:[me.getContractPanel(),me.getAdditionalPanels()]});Application.components.Contract2ContractBaseTabPanel.superclass.initComponent.call(this)}});Ext.define("Application.components.Contract2ContractRejectPanel",{extend:"Application.components.ContractTypedFilesPanel",hiddenEmpty:true,title:"\u041f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u043e\u0442\u043a\u0430\u0437\u0430 \u043e\u0442 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430",uploadButtonTitle:"\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b",onlyOneSignedFile:true, showInfopanel:false,renderUploadButton:function(){var component=this;return{text:component.uploadButtonTitle,disabled:false,handler:function(){var reject_variants=[[1,"\u0423\u0447\u0430\u0441\u0442\u043d\u0438\u043a \u0443\u043a\u043b\u043e\u043d\u0438\u043b\u0441\u044f \u043e\u0442 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"],[4,"\u041d\u0435\u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0438\u043b\u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441 \u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u0435\u043c \u0443\u0441\u043b\u043e\u0432\u0438\u0439 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"]]; if(component.lotInfo["procedure_type"]&&component.lotInfo["procedure_type"]==PROCEDURE_TYPE_PRICELIST_REQ)reject_variants.push([3,"\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u0430 \u043e \u043d\u0435\u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"]);reject_variants.push([2,"\u0418\u043d\u043e\u0435"]);component.win=new Ext.Window({autoHeight:true,width:780,closeAction:"close",modal:true, title:"\u0424\u0430\u0439\u043b \u043e\u0442\u043a\u0430\u0437\u0430",items:[{layout:"form",border:false,autoheight:true,frame:true,items:[{xtype:"combo",hiddenName:"reason_id",mode:"local",editable:false,triggerAction:"all",fieldLabel:"\u041e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0442\u043a\u0430\u0437\u0430",store:reject_variants,value:1}],params:{"id":component.lotInfo.id,"currentCustomer":component.currentCustomer,"currentSupplier":component.currentSupplier,"type_id":Application.models.Contract.FILE_TYPE.repudiation}, fileUpload:true,xtype:"Application.components.uploadContractForm",componentParent:component,filePanelId:"upload-draft-form",labelWidth:150,parentWin:component,listeners:{cancelled:function(){component.win.close()},uploadComplete:function(response){component.win.close();Main.app.run()}}}]});component.win.show()}}},initComponent:function(){Application.components.Contract2ContractRejectPanel.superclass.initComponent.call(this)}});Ext.define("Application.components.Contract2ContractTabPanel",{extend:"Application.components.Contract2ContractBaseTabPanel",currentContract:null,title:"\u0414\u043e\u0433\u043e\u0432\u043e\u0440",baseTitle:"\u0414\u043e\u0433\u043e\u0432\u043e\u0440",getAdditionalPanels:function(){var me=this;var items=[];var contractFiles=filterFiles(me.files,{type_id:me.fileTypeId});items.push({xtype:"Application.components.ContractTypedFilesPanel",files:filterFiles(me.files,{type_id:Application.models.Contract.FILE_TYPE.supplier_guarantee}), enableDeleteLastVersion:true,title:"\u041e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430",showInfopanel:false,fileTypeId:Application.models.Contract.FILE_TYPE.supplier_guarantee,signStrategy:["supplier"],currentCustomer:me.currentCustomer,currentSupplier:me.currentSupplier,currentOrganizer:me.currentOrganizer,uploadContragentType:"supplier",signRpcMethod:RPC.Contract.actualLastVersion, fileHashRpcMethod:me.fileHashRpcMethod,suppliers:me.suppliers,lotInfo:me.lotInfo,actualMode:me.actualMode,uploadButtonTitle:"\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442",locked:me.locked,hiddenEmpty:true,hidden:isEmpty(contractFiles)||me.contractSignMode===CONTRACT_SIGN_PAPER,tabIndex:me.tabIndex,checkSignPossibility:true});var contractSigned=me.currentContract&&me.currentContract["id"]&&(!!me.currentContract["customerSigned"]&&!!me.currentContract["supplierSigned"]|| me.contractSignMode===CONTRACT_SIGN_PAPER&&me.lotInfo["contractSigned"])&&(me.isActualCustomer()||isAdmin()||in_array(10,Main.user.roles));if(contractSigned)items.push({xtype:"Application.components.Contract2OosContractPanel",currentContract:me.currentContract,contractsInfo:me.currentContract["oos_contract_info"]});if(me.isPossibleContragent()||isAdmin())items.push({xtype:"Application.components.Contract2ContractRejectPanel",files:filterFiles(me.files,{type_id:Application.models.Contract.FILE_TYPE.repudiation}), fileTypeId:Application.models.Contract.FILE_TYPE.repudiation,discrepancyFileTypeId:null,signStrategy:["customer"],onlyOneSignedFile:true,currentCustomer:me.currentCustomer,currentSupplier:me.currentSupplier,currentOrganizer:me.currentOrganizer,uploadContragentType:"customer",enableDeleteLastVersion:true,signRpcMethod:RPC.Contract.signrepudiation,fileHashRpcMethod:me.fileHashRpcMethod,suppliers:me.suppliers,hiddenEmpty:true,lotInfo:me.lotInfo,actualMode:me.actualMode,viewCancelled:me.isPossibleContragent(), locked:!me.isActualSupplier()||contractSigned,getSignParams:function(){return{lot_id:this.lotInfo.id,repudiation_id:this.getActualFiles()[0].id,contract_id:me.currentContract&&me.currentContract.id,currentCustomer:this.currentCustomer,currentSupplier:this.currentSupplier,type:this.actualMode,type_id:this.fileTypeId,tab_index:this.tabIndex}}});items.push({xtype:"Application.components.ContractTypedFilesPanel",files:filterFiles(me.files,{type_id:Application.models.Contract.FILE_TYPE.customer_other}), title:"\u041f\u0440\u043e\u0447\u0438\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u0430",fileTypeId:Application.models.Contract.FILE_TYPE.customer_other,discrepancyFileTypeId:null,signStrategy:[],showInfopanel:false,hiddenEmpty:true,currentCustomer:me.currentCustomer,currentSupplier:me.currentSupplier,currentOrganizer:me.currentOrganizer,uploadContragentType:"customer",signRpcMethod:me.signRpcMethod,fileHashRpcMethod:me.fileHashRpcMethod, suppliers:me.suppliers,lotInfo:me.lotInfo,actualMode:me.actualMode,enableDeleteLastVersion:true,uploadButtonTitle:"\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442"});items.push({xtype:"Application.components.ContractTypedFilesPanel",files:filterFiles(me.files,{type_id:Application.models.Contract.FILE_TYPE.supplier_other}),title:"\u041f\u0440\u043e\u0447\u0438\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044f", showInfopanel:false,hiddenEmpty:true,fileTypeId:Application.models.Contract.FILE_TYPE.supplier_other,discrepancyFileTypeId:null,signStrategy:[],currentCustomer:me.currentCustomer,currentSupplier:me.currentSupplier,currentOrganizer:me.currentOrganizer,uploadContragentType:"supplier",signRpcMethod:me.signRpcMethod,fileHashRpcMethod:me.fileHashRpcMethod,suppliers:me.suppliers,lotInfo:me.lotInfo,actualMode:me.actualMode,enableDeleteLastVersion:true,uploadButtonTitle:"\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442"}); if(Main.user.eds_type==EDS_TYPE_PERSONAL&&me.isActualSupplier()&&me.isUserActualSupplier()||me.lotInfo.user_digitalpoa_id)items.push({xtype:"Application.components.DigitalPoaSelectFieldset",editable:me.actualMode,name:"user_digitalpoa_id",value:me.lotInfo.user_digitalpoa_id,hideDeleteButton:me.currentContract&&me.currentContract.mainSupplierSigned||me.lotInfo.contractSigned||!me.isActualSupplier()||!me.isUserActualSupplier(),listeners:{render:function(){if(this.value)this.fireEvent("selected",this, this.value,true);else me.disableSignButton()},clear:function(){performRPCCall(RPC.Lot.savePoa,[{id:me.lotInfo.id,remove_user_digitalpoa:this.value}],[],function(resp){if(!resp.success)return});me.disableSignButton()},selected:function(cmp,id,dont_save){if(!dont_save)performRPCCall(RPC.Lot.savePoa,[{id:me.lotInfo.id,user_digitalpoa:id}],[],function(resp){if(!resp.success)return});me.enableSignButton()}}});if(me.actualMode==="Customer"&&!!me.currentContract&&!!me.currentContract["customerSigned"]&& !!me.currentContract["supplierSigned"]&&me.lotInfo["procedure_type"]!==PROCEDURE_TYPE_PAPER_SINGLE_SUPPLIER)items.push({xtype:"fieldset",style:"margin: 10px 0 0 0;",items:[{border:false,buttonAlign:"center",padding:0,margin:0,buttons:[{text:"\u0417\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443",handler:function(){performRPCCall(RPC.Contract.archivate,[{lot_id:me.lotInfo.id,contract_id:me.currentContract.id}],{waitMsg:"\u0417\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b..."}, function(resp){echoResponseMessage(resp,function(){Main.app.run()})})}}]}]});return items},initComponent:function(){Application.components.Contract2ContractTabPanel.superclass.initComponent.call(this)}});Ext.define("Application.components.Contract2FormPanel",{extend:"Ext.form.FormPanel",autoHeight:true,layout:"form",frame:true,defaults:{xtype:"fieldset",style:"margin: 5px 5px 5px;",bodyCssClass:"subpanel",collapsible:false,defaults:{xtype:"fieldset",collapsible:false}},lot_id:null,customer_id:null,supplier_id:null,as_mode:null,activeTab:null,mode:null,dual_mode:null,mode_additional:null,lotInfo:null,files:null,currentSupplier:null,currentSupplierInfo:null,currentCustomer:null,suppliers:null,customers:null, currentContract:null,agreementRequired:null,signatureRequired:null,supplierRefusedSign:null,participants_eds_info:null,currency:null,organizerContragent:null,additional_suppliers:null,enough_money_for_sign:null,contract_repudation:null,price_after_negotination:null,activeTab:null,customerEdsInfo:null,getWaitParams:function(title){return{mask:true,handle_failure:true,scope:this,monitor_valid:this,wait_text:title||"\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442\u0441\u044f \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u043e\u0432"}}, onAfterRender:function(){var me=this;performRPCCall(RPC.Contract.load,[{lot_id:me.lot_id,customer_id:me.customer_id,supplier_id:me.supplier_id,as_mode:me.as_mode}],me.getWaitParams(),function(response){if(!!response.success){echoResponseMessage(response);return}me.fireEvent("contractloaded",response)})},loadContractResponse:function(response){var me=this;var fieldsToFill=["mode","dual_mode","mode_additional","lotInfo","files","currentSupplier","currentSupplierInfo","currentCustomer","suppliers","customers", "currentContract","agreementRequired","signatureRequired","supplierRefusedSign","participants_eds_info","currency","organizerContragent","additional_suppliers","enough_money_for_sign","contract_repudation","activeTab","customerEdsInfo","price_after_negotination"];Ext.iterate(fieldsToFill,function(fieldName){me[fieldName]=response[fieldName]||null})},onContractLoaded:function(response){var me=this;me.loadContractResponse(response);me.fireEvent("initpanels");if(me.agreementRequired===null&&me.signatureRequired=== null&&(me.currentCustomer==Main.user.contragent_id||me.organizerContragent==Main.user.contragent_id))me.fireEvent("showcontractdecisionform")},renderRegistryNumber:function(lotInfo){return lotInfo["registry_number"]+", \u043b\u043e\u0442 \u2116 "+(lotInfo["number"]||1)},findRecordById:function(id,store){for(var i=0;i(\u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e: "+additional.join(", ")+")"}return allCompanies[i]["full_name"]}return"?"},getLotInfoPanel:function(){var me=this;var fields={registry_number:"\u0420\u0435\u0435\u0441\u0442\u0440\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b", title:"\u041d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043b\u043e\u0442\u0430",price:"\u041d\u0430\u0447\u0430\u043b\u044c\u043d\u0430\u044f (\u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f) \u0446\u0435\u043d\u0430 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430",commodity_price:"\u0426\u0435\u043d\u0430 \u0442\u043e\u0432\u0430\u0440\u0430, \u0440\u0430\u0431\u043e\u0442\u044b, \u0443\u0441\u043b\u0443\u0433\u0438",customer:"\u0417\u0430\u043a\u0430\u0437\u0447\u0438\u043a", contract_participants:"\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u0441 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430\u043c\u0438",winner:"\u0417\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044c, \u043f\u0440\u0438\u0437\u043d\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u0431\u0435\u0434\u0438\u0442\u0435\u043b\u0435\u043c \u0432 \u0442\u043e\u0440\u0433\u0430\u0445 \u043f\u043e \u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u043b\u043e\u0442\u0443", final_price:"\u0426\u0435\u043d\u0430 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430",guarantee_contract:"\u0422\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430",agreement_required:"\u041f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430",signature_required:"\u0414\u043e\u0433\u043e\u0432\u043e\u0440", addnumber:"\u041d\u043e\u043c\u0435\u0440 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430",contractPriceAfterNegotination:"\u0426\u0435\u043d\u0430 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u043f\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c \u043f\u0435\u0440\u0435\u0433\u043e\u0432\u043e\u0440\u043e\u0432"};fieldsValues=me.lotInfo;fieldsValues.registry_number=me.renderRegistryNumber(me.lotInfo);fieldsValues.agreement_required="\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f"; if(me.lotInfo.price_form==PRICE_FORM_UNIT_PRICE_AND_MAX_CONTRACT_PRICE)fieldsValues.commodity_price=me.lotInfo.commodity_price;fieldsValues.customer=me.renderCompany(me.currentCustomer,me.customers);var winner=this.findRecordById(me.lotInfo["contract_supplier_id"]||null,me.suppliers);if(winner){fields.winner="\u0417\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044c, \u043f\u0440\u0438\u0437\u043d\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u0431\u0435\u0434\u0438\u0442\u0435\u043b\u0435\u043c \u0432 \u0442\u043e\u0440\u0433\u0430\u0445 \u043f\u043e \u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u043b\u043e\u0442\u0443"; fieldsValues.winner=this.renderCompany(winner.id,me.suppliers);if(!!winner["preference925_applied"])fields.final_price="\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0446\u0435\u043d\u043e\u0432\u043e\u0435 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043f\u043e\u0434\u0430\u043d\u043d\u043e\u0435 \u043f\u043e\u0431\u0435\u0434\u0438\u0442\u0435\u043b\u0435\u043c \u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442\u0430 (\u041f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u041f\u0440\u0430\u0432\u0438\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430 \u0420\u0424 \u043e\u0442 16 \u0441\u0435\u043d\u0442\u044f\u0431\u0440\u044f 2016 \u0433. \u2116925)"; else fields.final_price="\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0446\u0435\u043d\u043e\u0432\u043e\u0435 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043f\u043e\u0434\u0430\u043d\u043d\u043e\u0435 \u043f\u043e\u0431\u0435\u0434\u0438\u0442\u0435\u043b\u0435\u043c";fieldsValues.final_price=winner.price||me.lotInfo.start_price}else if(me.lotInfo.winner_id&&me.lotInfo.final_price)fieldsValues.final_price=me.lotInfo["final_price"]||"";if(me.lotInfo["is_contract_sign"]){fields.winner= undefined;fields.final_price=undefined;fieldsValues.winner=undefined;fieldsValues.final_price=undefined}if(me.lotInfo["many_participants"]){fields.winner=undefined;fields.final_price=undefined;fieldsValues.winner=undefined;fieldsValues.final_price=undefined;fields.contract_participants="\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u0441 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430\u043c\u0438";var contractParticipants=[]; Ext.each(me.suppliers,function(v){if(v.contract_applied)contractParticipants.push(v.short_name)});fieldsValues.contract_participants=contractParticipants.join(", ")}else fields.contract_participants=undefined;fieldsValues.guarantee_contract=me.lotInfo["guarantee_needed"]?"\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e":"\u043d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e";if(!isEmpty(me.signatureRequired))fieldsValues.signature_required=CONTRACT_TYPE_TITLES[me.signatureRequired]|| "?";if(!!me.currentContract&&!!me.currentContract["customerSigned"]&&!!me.currentContract["supplierSigned"]||!!me.currentContract&&me.signatureRequired===CONTRACT_SIGN_PAPER)fieldsValues.addnumber={xtype:"Application.components.ContractNumberPanel",contractInfo:me.currentContract,value:me.currentContract["registration_number"],editable:me.currentContract["customer_id"]==Main.contragent.id};if(me.lotInfo["procedure_type"]!==PROCEDURE_TYPE_PAPER_SINGLE_SUPPLIER)fieldsValues.contractPriceAfterNegotination= {xtype:"Application.components.ContractPriceAfterNegotinationPanel",contractInfo:{lotId:me.lotInfo["id"],customerId:me.currentCustomer,supplierId:me.currentSupplier},value:me.price_after_negotination||null,editable:in_array(Main.contragent.id,[me.currentCustomer,me.organizerContragent])};return{xtype:"Application.components.keyValue2Panel",title:"\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u043b\u043e\u0442\u0435",anchor:"100%",autoHeight:true,fields:fields,templates:{registry_number:'{registry_number}', price:new Ext.XTemplate(''+"{[Ext.util.Format.formatPrice(values.price)]} "+renderCurrencySign(me.currency.name)+""),commodity_price:new Ext.XTemplate(''+"{[Ext.util.Format.formatPrice(values.commodity_price)]} "+renderCurrencySign(me.currency.name)+""),final_price:new Ext.XTemplate(''+"{[Ext.util.Format.formatPrice(values.final_price)]} "+renderCurrencySign(me.currency.name)+"")},values:fieldsValues,style:"margin: 5px 5px 0px", defaults:{xtype:"panel"}}},getParticipantsPanel:function(){var me=this;return{xtype:"fieldset",ref:"participantsPanelCmp",title:"\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0434\u043e\u0433\u043e\u0432\u0430\u0440\u0438\u0432\u0430\u044e\u0449\u0438\u0445\u0441\u044f \u0441\u0442\u043e\u0440\u043e\u043d\u0430\u0445",items:{xtype:"Application.components.Contract2ParticipantsPanel",parentCmp:me}}},getContactNotificationPanel:function(){var me=this;if(isEmpty(me["enough_money_for_sign"])|| me["enough_money_for_sign"]===true)return{};return{xtype:"fieldset",hideTitle:true,style:"padding: 10px; background-color: red;border: none; color: #fff",anchor:"100%",border:false,layout:"anchor",items:{html:me["enough_money_for_sign"]}}},getContractTab:function(){var me=this;var files=me.getMainTabFiles();return{xtype:"Application.components.Contract2ContractTabPanel",files:files,contractHeader:me.getContactNotificationPanel(),fileTypeId:Application.models.Contract.FILE_TYPE.draft,discrepancyFileTypeId:Application.models.Contract.FILE_TYPE.discrepancy, lotInfo:me.lotInfo,currentCustomer:me.currentCustomer,currentSupplier:me.currentSupplier,currentOrganizer:me.organizerContragent,contractSignMode:me.signatureRequired,actualMode:me.mode,locked:me.mode==="View",currentContract:me.currentContract,signRpcMethod:RPC.Contract.sign,fileHashRpcMethod:RPC.Contract.loadHash,suppliers:me.suppliers,customerEdsInfo:me.customerEdsInfo}},getAdditionalContractTabTemplate:function(){var me=this;return{title:"\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435", xtype:"Application.components.Contract2AdditionalContractTabPanel",files:[],fileTypeId:Application.models.Contract.FILE_TYPE.additional_agreement,discrepancyFileTypeId:Application.models.Contract.FILE_TYPE.discrepancy,lotInfo:me.lotInfo,currentCustomer:me.currentCustomer,currentSupplier:me.currentSupplier,currentOrganizer:me.organizerContragent,currentContract:me.currentContract,contractSignMode:me.signatureRequired,signRpcMethod:RPC.Contract.signAdditionalAgreement,fileHashRpcMethod:RPC.Contract.loadHash, suppliers:me.suppliers,tabIndex:null}},getFilesByIndexes:function(){var me=this;var filesByTabs=[];Ext.iterate(me.files,function(file){var index=file.tab_index||0;if(filesByTabs[index]===undefined)filesByTabs[index]=[];filesByTabs[index].push(file)});return filesByTabs},getMainTabFiles:function(){var filesByTabs=this.getFilesByIndexes();return filesByTabs[0]||[]},getFilesByTabs:function(){var filesByTabs=this.getFilesByIndexes();delete filesByTabs[0];return filesByTabs},getAdditionalContractTabs:function(){var me= this;var filesByTabs=me.getFilesByTabs();var tabs=[];Ext.each(filesByTabs,function(files,tabIndex){if(isEmpty(files))return true;tabs.push(me.getAdditionalDocTab(tabIndex,files))});return tabs},getAdditionalDocTab:function(index,files){var me=this;files=files;return Ext.apply(me.getAdditionalContractTabTemplate(),{title:"\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435 #"+index,files:files,closable:me.currentCustomer== getActiveCompany(),tabIndex:index,listeners:{beforeclose:function(panel){var file=panel.files?panel.files[panel.files.length-1]:false;if(file&&file.supplierSigned){Ext.Msg.alert("\u041e\u0448\u0438\u0431\u043a\u0430","\u0412\u043d\u0435\u0441\u0435\u043d\u0438\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u043d\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043b\u0435 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u043e\u043c"); return false}},close:function(panel){if(panel.files.length)Ext.each(panel.files,function(file){if(file)performRPCCall(RPC.Contract.removeFile,[file],{wait_text:"\u0424\u0430\u0439\u043b \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0441\u044f. \u041f\u043e\u0434\u043e\u0436\u0434\u0438\u0442\u0435..."},function(result){if(!result.success)echoResponseMessage(result)})})}}})},onUpdatedownloadcontractbutton:function(tp,newtab){var me=this;var button=me.participantsPanelCmp.downloadContractButton;if(!button)return; var files=newtab.files;button.setDisabled(isEmpty(files));if(newtab.xtype==="Application.components.Contract2AdditionalContractTabPanel"){button.setText(button.template_text+" \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f");fileType=14}else if(!isEmpty(files)&&newtab.xtype==="Application.components.Contract2ContractTabPanel"){button.setText(button.template_text+" \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"); fileType=1}else return;var contractFiles=filterFiles(files,{type_id:fileType,"is_last_version":true});if(!isEmpty(contractFiles))button.file_link=contractFiles[0].link},onUpdatesigninfobutton:function(tp,newtab){var me=this;var button=me.participantsPanelCmp.downloadContractInfoButton;if(!button)return;var files=newtab.files;if(newtab.xtype==="Application.components.Contract2AdditionalContractTabPanel"){button.setText(button.template_text+" \u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u043c \u0434\u043e\u043f. \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0438"); fileType=14}else if(!isEmpty(files)&&newtab.xtype==="Application.components.Contract2ContractTabPanel"){button.setText(button.template_text+" \u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u043c \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0435");fileType=1}else return;var contractFiles=filterFiles(files,{type_id:fileType,"is_last_version":true,"tab_index":newtab.tabIndex});button.setDisabled(isEmpty(contractFiles)||!contractFiles[0].date_customer_eds||!contractFiles[0].date_supplier_eds); if(!isEmpty(contractFiles))button.contract_id=contractFiles[0].id},getContractTabPanel:function(){var me=this;var tabs=[];if(me.currentSupplier===null||me.signatureRequired===null)return{};tabs.push(me.getContractTab());var addContractTabs=me.getAdditionalContractTabs();var activeTab=me.activeTab;Ext.each(addContractTabs,function(tab,index){if(tab.tabIndex==me.activeTab)activeTab=index+1});tabs.push(addContractTabs);if((Main.contragent.id==me.currentCustomer||Main.contragent.id==me.organizerContragent)&& me.currentContract&&me.currentContract["customerSigned"]&&me.lotInfo.status===8)tabs.push({title:"\u041d\u043e\u0432\u043e\u0435 \u0434\u043e\u043f. \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435",addItemHandler:true,iconCls:"icon-silk-add"});var tabPanel=new Ext.TabPanel({activeTab:activeTab||0,frame:true,enableTabScroll:true,defaults:{autoHeight:true,frame:true},padding:0,items:tabs,listeners:{beforetabchange:function(tp,newtab){if(newtab&&newtab.addItemHandler){tp.addAdditionalPanelsTab(); return false}return true},tabchange:function(tp,newtab){me.fireEvent("updatedownloadcontractbutton",tp,newtab);me.fireEvent("updateSignInfoButton",tp,newtab)}},isPreviousPanelHasFiles:function(){prevPos=this.items.getCount()-1;var prev_panel=this.items.get(prevPos-1);var hasFiles=false;if(prev_panel)if(prev_panel.items.get(0)&&["Application.components.Contract2PaperContractFilesPanel","Application.components.ContractTypedFilesPanel"].indexOf(prev_panel.items.get(0).xtype)>-1)hasFiles=!isEmpty(prev_panel.items.get(0).files); return hasFiles},getLastTabIndex:function(){prevPos=this.items.getCount()-1;var prev_panel=this.items.get(prevPos-1);if(prev_panel&&prev_panel.tabIndex)return prev_panel.tabIndex;return this.items.getCount()-2},addAdditionalPanelsTab:function(){var insPos=this.items.getCount()-1;var lastTabIndex=this.getLastTabIndex();var tabIndex=insPos;if(lastTabIndex)tabIndex=lastTabIndex+1;var newTab=Ext.apply(me.getAdditionalDocTab(tabIndex,[]));this.insert(insPos,newTab);if(this.rendered)this.doLayout(false, true);this.setActiveTab.defer(100,this,[insPos]);return this}});return tabPanel},logFiles:function(){Ext.iterate(this.files,function(file){console.log(file["id"]+": "+file["name"]+"\ntype: "+CONTRACT_FILE_TYPES[file["type_id"]]+"("+file["type_id"]+")"+(file["is_last_version"]?"[X]":"[-]"))})},onInitPanels:function(){var me=this;me.removeAll(true);me.add(me.getLotInfoPanel());me.add(me.getParticipantsPanel());if(me.currentSupplier!==null&&me.signatureRequired!==null)me.add(me.getContractTabPanel()); me.doLayout()},saveRequirements:function(values,cb){var component=this;var waitParams=component.getWaitParams("\u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u043a \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0443");function redirectToArchiveIdFinalized(resp,message){if(resp.finalized)if(!!Main.config.contract_final_step){alertSuccess("\u0414\u043e\u0433\u043e\u0432\u043e\u0440 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d"); redirect_to("com/procedure/index")}else{alertSuccess(message);redirect_to("com/procedure/index/type/archive")}}performRPCCall(RPC.Contract.saveCustomerRequirements,[values],waitParams,function(resp){if(resp.finalized)redirectToArchiveIdFinalized(resp,"\u0414\u043e\u0433\u043e\u0432\u043e\u0440 \u043d\u0435 \u043d\u0443\u0436\u0434\u0430\u0435\u0442\u0441\u044f \u0432 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u0438, \u043b\u043e\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d \u0432 \u0430\u0440\u0445\u0438\u0432"); else{alertSuccess(resp.msg);redirect_to("com/procedure/index")}if(cb)cb()})},onShowContractDecisionForm:function(){var component=this;var decision_form_id=Ext.id();var win=new Ext.Window({title:"\u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u0438\u0442\u043e\u0433\u043e\u0432 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b",modal:true,closable:true,plugins:[Ext.ux.plugins.LimitSize],applyLayout:true,autoHeight:true,width:700,items:[{xtype:"Application.components.ProcedureDecisionForm", layout:"anchor",name:"decision",id:decision_form_id,hideButtons:false,values:{lot:component.lotInfo,suppliers:component.suppliers,customers:component.customers,currency:component.currency,currentCustomer:component.currentCustomer,currentSupplier:component.currentSupplier}}]});win.show()},initComponent:function(){var me=this;me.addEvents("contractloaded","initpanels","showcontractdecisionform","updatedownloadcontractbutton","updatesigninfobutton");Ext.apply(me,{tools:[{id:"refresh",handler:function(){Main.app.run()}, qtip:"\u041e\u0431\u043d\u043e\u0432\u0438\u0442\u044c"}],listeners:{afterrender:me.onAfterRender,contractloaded:me.onContractLoaded,initpanels:me.onInitPanels,showcontractdecisionform:me.onShowContractDecisionForm,updatedownloadcontractbutton:me.onUpdatedownloadcontractbutton,updatesigninfobutton:me.onUpdatesigninfobutton}});Application.components.Contract2FormPanel.superclass.initComponent.call(this)}});Ext.define("Application.components.Contract2OosContractGrid",{extend:"Ext.grid.GridPanel",autoHeight:true,initComponent:function(){var me=this;Ext.apply(me,{colModel:new Ext.grid.ColumnModel({defaults:{sortable:false},columns:[{header:"\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u044f",width:200,xtype:"textactioncolumn",items:[{text:function(value,p,record){var type=record.get("type");switch(type){case TYPE_OOS_CONTRACT:return"\u041f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0432 \u0440\u0435\u0435\u0441\u0442\u0440 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u043e\u0432"; case TYPE_OOS_PURCHASE_CONTRACT:return"\u041f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0434\u043e\u0433\u043e\u0432\u043e\u0440 \u0432 \u0440\u0435\u0435\u0441\u0442\u0440 \u0437\u0430\u043a\u0443\u043f\u043e\u043a";case TYPE_OOS_SUBCONTRACTOR_INFO:return"\u041f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0435 \u0441 \u0441\u0443\u0431\u043f\u043e\u0434\u0440\u044f\u0434\u0447\u0438\u043a\u043e\u043c"; case TYPE_OOS_CONTRACT_EXECUTION:return"\u041f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e\u0431 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430";case TYPE_OOS_CONTRACT_TERMINATION:return"\u041f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e \u0440\u0430\u0441\u0442\u043e\u0440\u0436\u0435\u043d\u0438\u0438 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"; default:return"?"}},handler:function(grid,rowIndex){var store=grid.getStore(),record=store.getAt(rowIndex),data=record.data,id="id/"+data.contract_id,type="type/"+data.type;switch(data.type){case TYPE_OOS_PURCHASE_CONTRACT:showOOSPublishForm();break;case TYPE_OOS_CONTRACT:case TYPE_OOS_SUBCONTRACTOR_INFO:case TYPE_OOS_CONTRACT_EXECUTION:case TYPE_OOS_CONTRACT_TERMINATION:redirect_to("com/contract/send/"+id+"/"+type);break}}}]},{header:"\u0414\u0430\u0442\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438", width:100,dataIndex:"date_published",sortable:true,renderer:function(v){return Ext.util.Format.localDateRenderer(v,true)}},{header:"\u0412\u0435\u0440\u0441\u0438\u044f",width:50,dataIndex:"version",sortable:true},{header:"\u0421\u0442\u0430\u0442\u0443\u0441",dataIndex:"status",sortable:true,renderer:function(val,meta,record){switch(val){case OOS_STATUS_DECLINED:return"\u041e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u043e: "+record.get("error_detail");case OOS_STATUS_QUEUED:if(isEmpty(record.get("date_send")))return"\u041e\u0436\u0438\u0434\u0430\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0432 \u0415\u0418\u0421..."; return"\u041e\u0436\u0438\u0434\u0430\u0435\u0442 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0432 \u0415\u0418\u0421";case OOS_STATUS_PUBLISHED:return"\u041e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d \u0432 \u0415\u0418\u0421"}}},{xtype:"textactioncolumn",header:"",width:15,items:[{tooltip:"\u0412\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u0415\u0418\u0421",icon:"/ico/oos.png",scope:this,isHidden:function(v,m,r){return r.data.status== OOS_STATUS_ZERO},handler:function(grid,rowIndex){var record=grid.store.getAt(rowIndex);var eventWindow=new Ext.Window({closeAction:"close",width:800,height:400,layout:"fit",modal:true,maximizable:true,title:"\u0412\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u0415\u0418\u0421 \u043f\u043e \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0443",items:[{xtype:"Application.components.OosGrid",filter_key:"oos_contract_id",filter_value:record.data.oos_contract_id,height:369}]}); eventWindow.show()}}]}]}),viewConfig:{forceFit:true}});Application.components.Contract2OosContractGrid.superclass.initComponent.call(this)}});Ext.define("Application.components.Contract2OosContractPanel",{extend:"Ext.form.FieldSet",parentCmp:null,title:"\u041f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u0415\u0418\u0421",contractTypesStore:null,contractsInfo:[],currentContract:null,getWarningPanel:function(){return{xtype:"panel",frame:false,border:false,padding:"0 0 10px 0",style:"text-align:center",html:'\u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435!
      \u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0435 \u043d\u0430 zakupki.gov.ru, \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0437\u0430\u043a\u0443\u043f\u043a\u0430 \u043f\u0435\u0440\u0435\u0432\u0435\u0434\u0435\u043d\u0430 \u043d\u0430 \u044d\u0442\u0430\u043f "\u0420\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e" \u0432 \u043b\u0438\u0447\u043d\u043e\u043c \u043a\u0430\u0431\u0438\u043d\u0435\u0442\u0435 \u0415\u0418\u0421'}}, getOosContractTypesStore:function(){if(!this.contractTypesStore)this.contractTypesStore=new Ext.data.JsonStore({idProperty:"type",fields:["oos_contract_id","contract_id","date_published","version","status","type","date_send","error_detail"]});return this.contractTypesStore},getGrid:function(){var me=this;var store=this.getOosContractTypesStore();data=[{type:TYPE_OOS_CONTRACT},{type:TYPE_OOS_CONTRACT_EXECUTION},{type:TYPE_OOS_CONTRACT_TERMINATION}];for(var i in data){var rec=me.contractsInfo.filter(function(rec){return rec.type== data[i].type}).shift();if(rec){rec.contract_id=me.currentContract.id;data[i]=rec}}store.loadData(data);return{xtype:"Application.components.Contract2OosContractGrid",store:store}},initComponent:function(){var me=this;Ext.apply(me,{items:[me.getWarningPanel(),me.getGrid()]});Application.components.Contract2OosContractPanel.superclass.initComponent.call(this)}});Ext.define("Application.components.Contract2PaperContractFilesPanel",{extend:"Application.components.ContractTypedFilesPanel",getVisibleFilesByArray:function(filesArray){var result=[];var me=this;Ext.iterate(filesArray,function(file){if(me.isActualSupervisor()||isEmpty(me.signStrategy)||!!file["customerSigned"]||!!file["supplierSigned"]||me.isUploadableContragent())result.push(file);else if(me.signStrategy[0]===me.uploadContragentType&&me.actualMode&&me.actualMode.toLowerCase()===me.uploadContragentType)result.push(file); else if(me.isActualCustomer())result.push(file);else if(!!file.is_last_version&&me.isActualSupplier())result.push(file)});return result},isSignableContragent:function(){if((this.isActualCustomer()||this.isActualOrganizer())&&!this.isLastFileSignFinished()&&this.isUploadableContragent())return true;return Application.components.Contract2PaperContractFilesPanel.superclass.isSignableContragent.call(this)},renderContractConfirmingSignatureText:function(){return"\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u0432 \u043f\u0438\u0441\u044c\u043c\u0435\u043d\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u0435 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u043e \u043f\u043e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435 "+ (this.lotInfo["registry_number"]||"-")},preSigningMethod:function(){var me=this;if(isEmpty(me.getActualFiles())&&isEmpty(me.getFiles())){var parameters={"lot_id":me.lotInfo.id,"currentCustomer":me.currentCustomer,"currentSupplier":me.currentSupplier};var winItems=[];for(var paramName in parameters)winItems.push({xtype:"hidden",name:paramName,value:parameters[paramName]});var win=new Application.components.promptWindow({title:"\u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430", cmpType:"Application.components.SignatureForm",parentCmp:me,modal:true,cmpParams:{api:me.signRpcMethod,signatureText:me.renderContractConfirmingSignatureText(),signatureTextHeight:250,useFormHandler:false,items:winItems,success_fn:function(resp){me.fireEvent("signed",resp);win.close()}}});win.show();return false}return true},renderStatusPanelItems:function(){var panels=[];var me=this;if(me.countActualFiles()||me.isLastFileSigned()){if(me.isSignedByCustomer())panels.push(me.renderSignatureInfoPanel(me.getFiles(), "customer","\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u043e"));if(me.needSignByCustomer()&&me.countVisibleFiles()>0)panels.push(me.renderInfoPanel('\u041e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u0442\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u0430')); if(me.isActualSupplier())panels.push(me.renderInfoPanel("\u041f\u0440\u0438 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u0432 \u043f\u0438\u0441\u044c\u043c\u0435\u043d\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u0435 \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u043d\u0430 \u0431\u0443\u043c\u0430\u0433\u0435"))}else if(!!me.showInfopanel)if(me.uploadContragentType== "customer"&&me.lotInfo.status===8)if(!!me.customerEdsInfo)panels.push(me.renderInfoPanel("\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u043e, "+Ext.util.Format.localDateText(parseDate(me.customerEdsInfo.dateSigned)),[{xtype:"button",text:"\u0420\u0435\u043a\u0432\u0438\u0437\u0438\u0442\u044b "+t("\u042d\u0426\u041f"),handler:function(){Application.models.Contract.showEdsInfo(Ext.util.Format.nl2br(me.customerEdsInfo.info))}}])); else panels.push(me.renderInfoPanel("\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u043e"));else if(me.uploadContragentType=="customer"&&!!me.isActualCustomer()){if(me.isUploadableContragent())panels.push(me.renderInfoPanel('\u041e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u043e\u043c'))}else if(me.uploadContragentType== "supplier"&&!!me.isActualSupplier())panels.push(me.renderInfoPanel('\u041e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u043e\u043c'));if(me.checkSignPossibility&&me.signStrategy.indexOf("supplier")>-1&&me.currentSupplier!==me.lotInfo["contract_supplier_id"])panels.push(me.renderInfoPanel("\u0414\u043e\u0433\u043e\u0432\u043e\u0440 \u0441 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u043c \u043d\u0435 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f")); return panels},initComponent:function(){Application.components.Contract2PaperContractFilesPanel.superclass.initComponent.call(this)}});Ext.define("Application.components.Contract2ParticipantsPanel",{extend:"Ext.panel.Panel",parentCmp:null,ids:{contragentAddId:Ext.id(),chooseContragentId:Ext.id()},renderInfo:function(title,value){return'
      '+title+": "+value+"
      "},renderTip:function(text,params){params=params||{};return'[?]'}, renderSelector:function(t){var me=this;return{layout:"form",frame:false,border:false,labelWidth:330,width:"100%",items:[{fieldLabel:me.renderInfo(t.title,""),labelSeparator:"",xtype:"combo",editable:false,anchor:"100%",store:t.store,triggerAction:"all",hiddenName:Ext.id(),value:t.value,mode:"local",listeners:{select:t.handler}}]}},getSuppliersArray:function(){var me=this;var result=[];Ext.iterate(me.parentCmp.suppliers,function(supplier,i){if(!supplier.position||supplier.position<0)return;var str= ""+(supplier.position||"?")+": "+(supplier.short_name||supplier.full_name);var additional_suppliers_array=[];if(!!supplier["multiply_suppliers"])Ext.each(supplier["additional_suppliers"],function(additional_supplier){additional_suppliers_array.push(additional_supplier["full_name"])});if(additional_suppliers_array.length>0)str+=" ("+additional_suppliers_array.join(", ")+")";str+=" ("+Ext.util.Format.formatPrice(supplier.price||me.parentCmp.lotInfo.start_price);if(supplier.pref_price&&supplier.price!= supplier.pref_price)str+="/"+Ext.util.Format.formatPrice(supplier.prev_price);str+=" "+renderCurrencySign(me.parentCmp.currency.name)+")";result.push([supplier.id,str,supplier.position||999])});result.sort(function(a,b){return a[2]-b[2]});return result},getCustomersArray:function(){var me=this;var result=[];Ext.iterate(me.parentCmp.customers,function(customer,i){result.push([customer.id,customer.short_name||customer.full_name])});result.sort(function(a,b){return a[0]-b[0]});return result},redirectToContract:function(customer, supplier,url){if(customer)url+="/customer/"+customer;if(supplier)url+="/supplier/"+supplier;redirect_to(url)},getSupplierInputPanel:function(){var me=this;var allowBlankPrice=me.parentCmp.lotInfo["procedure_type"]==PROCEDURE_TYPE_PAPER_SINGLE_SUPPLIER;return{xtype:"fieldset",title:"\u0417\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044c",hidden:me.parentCmp.signatureRequired===null,frame:false,items:[{xtype:"Application.components.ContragentSelectPanel",showSuppliers:true,showCustomers:false,showWithoutAccred:me.parentCmp.signatureRequired=== CONTRACT_SIGN_PAPER,border:false,useHandler:true,name:"contragent",emptyText:"",id:me.ids.chooseContragentId,addButtonText:"\u0412\u044b\u0431\u0440\u0430\u0442\u044c \u043a\u043e\u043d\u0442\u0440\u0430\u0433\u0435\u043d\u0442\u0430",additionalButtons:[{xtype:"button",text:"\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u0430\u0433\u0435\u043d\u0442\u0430",hidden:me.parentCmp.signatureRequired!==CONTRACT_SIGN_PAPER,style:"margin-left: 10px", handler:function(){var componentAdd=Ext.getCmp(me.ids.contragentAddId);componentAdd.setVisible(true);componentAdd.setDisabled(false);var componentChoose=Ext.getCmp(me.ids.chooseContragentId);componentChoose.setVisible(false)}}],getHtmlString:function(obj){return"\u041f\u043e\u043b\u043d\u043e\u0435 \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435: "+obj["full_name"]+"
      "+"\u0418\u041d\u041d/\u041a\u041f\u041f: "+obj["inn"]+"/"+obj["kpp"]},defaultValue:me.parentCmp.lotInfo.draft&& me.parentCmp.lotInfo.draft["contract_supplier"]?me.parentCmp.lotInfo.draft["contract_supplier"]:null},{xtype:"fieldset",border:true,id:me.ids.contragentAddId,hidden:true,disabled:true,items:[{xtype:"Application.components.ContractSupplierAddPanel",border:false,allowNotRegistered:me.parentCmp.signatureRequired==CONTRACT_SIGN_PAPER,hide_profile_type:true,useHandler:false,buttons:[{xtype:"button",text:"\u041e\u0442\u043c\u0435\u043d\u0430",hidden:false,handler:function(){var componentAdd=Ext.getCmp(me.ids.contragentAddId); componentAdd.setVisible(false);componentAdd.setDisabled(true);var componentChoose=Ext.getCmp(me.ids.chooseContragentId);componentChoose.setVisible(true)}}]}]},{xtype:"fieldset",border:false,cls:"no-spacing",items:[{xtype:"Application.components.priceField",name:"final_price",value:me.parentCmp.lotInfo.draft&&me.parentCmp.lotInfo.draft["final_price"]?parseFloat(me.parentCmp.lotInfo.draft["final_price"]):"",fieldLabel:"\u0426\u0435\u043d\u0430 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"+(!allowBlankPrice? REQUIRED_FIELD:""),allowBlank:allowBlankPrice},{xtype:"hidden",name:"lot_id",value:me.parentCmp.lotInfo["id"]}]}],buttons:[{text:"\u041f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c",formBind:true,handler:function(button){var scope=this.ownerCt.ownerCt;return scope.handler(button)}}],handler:function(button){var cmp=this;var values={};collectComponentValues(cmp,values);if(values["contragent"]){values["inn"]=values["contragent"]["inn"];values["full_name"]=values["contragent"]["full_name"];values["supplier_id"]= values["contragent"]["id"]}if(!values["supplier_id"]&&(!values["inn"]||!values["full_name"])||!values["final_price"]&&!allowBlankPrice){Ext.MessageBox.alert("\u041e\u0448\u0438\u0431\u043a\u0430","\u0417\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u0432\u0441\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044f");return}performRPCCall(RPC.Contract.assignContractSupplier,[values],[],function(resp){echoResponseMessage(resp);if(resp.success)Main.app.run()})}}},getCurrentSupplierInfoPanel:function(info){return{xtype:"Application.components.keyValue2Panel", border:false,margin:0,padding:0,style:"padding: 0",fields:{full_name:"\u0423\u0447\u0430\u0441\u0442\u043d\u0438\u043a \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u0431\u0435\u0434\u0438\u0442\u0435\u043b\u0435\u043c \u043f\u043e \u043b\u043e\u0442\u0443"},values:{full_name:info["full_name"]||"-"}}},getContractInfoButton:function(){var me=this;return{text:"\u041e\u0442\u043a\u0440\u044b\u0442\u044c \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f",template_text:"\u041e\u0442\u043a\u0440\u044b\u0442\u044c \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f", ref:"../../downloadContractInfoButton",contract_id:null,hidden:!(!!me.parentCmp.currentContract&&me.parentCmp.currentContract["customerSigned"]&&me.parentCmp.currentContract["supplierSigned"]),handler:function(){var params={lot_id:me.parentCmp.lot_id,contract_id:this.contract_id};performAjaxRPCCall("/contract/generateSignProtocol",params,{download:true,wait_disable:true})}}},getChangeSupplierButton:function(){var me=this;return{text:"\u0418\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u0430", disabled:me.parentCmp.currentContract&&me.parentCmp.currentContract["customerSigned"],hidden:!me.parentCmp.currentSupplier||me.parentCmp.lotInfo["procedure_type"]!==PROCEDURE_TYPE_PAPER_SINGLE_SUPPLIER||Main.contragent.id!==me.parentCmp.currentCustomer,handler:function(){performRPCCall(RPC.Contract.clearContractSupplier,[{id:me.parentCmp.lotInfo["id"]}],{confirm:"\u0412\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u0430?"}, function(resp){if(!!resp.success)Main.app.run();else echoResponseMessage(resp)})}}},getSupplierInfoButton:function(){var me=this;return{text:"\u0420\u0435\u043a\u0432\u0438\u0437\u0438\u0442\u044b \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430",hidden:isEmpty(me.getSuppliersArray()),handler:function(){Application.models.Contract.showSupplierRecs(me.parentCmp.currentSupplier,me.parentCmp.suppliers,me.parentCmp.additional_suppliers||[])}}},getAccreditationInfoButton:function(){var me=this;return{text:"\u0410\u043a\u043a\u0440\u0435\u0434\u0438\u0442\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f", hidden:!me.parentCmp["currentSupplier"],handler:function(){redirect_to("company/view/id/"+me.parentCmp.currentSupplier+"/withProcuracyFiles/1/withBank/1")}}},getDownloadContractButton:function(){var me=this;return{text:"\u0421\u043a\u0430\u0447\u0430\u0442\u044c \u0432\u0441\u0435 \u0444\u0430\u0439\u043b\u044b \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u0432 \u0432\u0438\u0434\u0435 \u0430\u0440\u0445\u0438\u0432\u0430",template_text:"\u0421\u043a\u0430\u0447\u0430\u0442\u044c \u0432\u0441\u0435 \u0444\u0430\u0439\u043b\u044b", ref:"../../downloadContractButton",file_link:null,hidden:!isAdmin()&&!inArrayOfObjects(me.getCustomersArray(),"id",Main.user.contragent_id)&&me.parentCmp.organizerContragent!=Main.user.contragent_id&&me.parentCmp.lotInfo.winner_id!=Main.user.contragent_id&&!(me.parentCmp.currentContract&&(me.parentCmp.currentContract.supplier_id==Main.user.contragent_id||inArrayOfObjects(me.parentCmp.currentContract.additional_suppliers_data,"id",Main.user.contragent_id)))&&(me.parentCmp.lotInfo.status!==7&&me.parentCmp.lotInfo.status!== 8)||!me.parentCmp.currentContract,handler:function(){if(!this.file_link)return;performAjaxRPCCall(this.file_link,{full_zip:1},{download:true,wait_disable:true},echoResponseMessage)}}},initComponent:function(){var me=this;var items=[];var buttons=[];var url="com/contract/index/lot/"+me.parentCmp.lotInfo["id"];var suppliers=me.getSuppliersArray();var customers=me.getCustomersArray();var currentCustomer=me.parentCmp.currentCustomer;var currentSupplier=me.parentCmp.currentSupplier;if(!isEmpty(customers))items.push(me.renderSelector({title:"\u0417\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u0438 \u043f\u043e \u043b\u043e\u0442\u0443"+ me.renderTip("\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430 \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u0430 \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u0445\u0441\u044f \u043a \u043d\u0435\u043c\u0443"),store:customers,value:currentCustomer,handler:function(combo,record){if(record.data.field1==currentCustomer)return; me.redirectToContract(record.data.field1,currentSupplier,url)}}));if(!isEmpty(suppliers))items.push(me.renderSelector({title:"\u0423\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0438 \u0442\u043e\u0440\u0433\u043e\u0432, \u0434\u043e\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0435 \u043a \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044e \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"+me.renderTip("\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430 \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u0445\u0441\u044f \u043a \u043d\u0435\u043c\u0443"), store:suppliers,value:currentSupplier,handler:function(combo,record){if(record.data.field1==currentSupplier)return;me.redirectToContract(currentCustomer,record.data.field1,url)}}));else if(me.parentCmp.currentSupplierInfo)items.push(me.getCurrentSupplierInfoPanel(me.parentCmp.currentSupplierInfo));else items.push(me.getSupplierInputPanel());buttons.push(me.getAccreditationInfoButton());buttons.push(me.getDownloadContractButton());buttons.push(me.getContractInfoButton());buttons.push(me.getChangeSupplierButton()); buttons.push(me.getSupplierInfoButton());Ext.apply(me,{items:items,buttons:buttons});Application.components.Contract2ParticipantsPanel.superclass.initComponent.call(this)}});Ext.define("Application.models.Company",{singleton:true,AccredStatuses:{5:"\u0410\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u043d (\u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043e)",4:"\u041e\u0442\u043a\u043b\u043e\u043d\u0435\u043d",3:"\u0410\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u043d",0:"\u041d\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u043d"},getAccredStatuses:function(){return Application.models.Company.AccredStatuses},renderAccredStatus:function(status){status= parseInt(status);var self=Application.models.Company,statuses=self.getAccredStatuses(),str=statuses[status];if(Ext.isEmpty(str))str=statuses[0];return str}});Application.models.ContractClass=Ext.extend(Ext.util.Observable,{FILE_TYPE:{draft:1,supplier_guarantee:3,other:7,discrepancy:9,repudiation:11,supplier_other:12,performance:13,additional_agreement:14,customer_other:15},renderTip:function(text,params){params=params||{};return'[?]'},findRecordById:function(id,store){for(var i= 0;i'+str+"";return str},draftsCount:function(files,type){var result=0;Ext.each(files, function(file){if(file.type_id!=type)return;if(!file.is_last_version)return;if(!!file.supplierSigned)return;if(!!file.customerSigned)return;result++});return result},filesCount:function(files,type,only_actual,only_signed,only_cosigned){var cnt=0;Ext.each(files,function(i){if(only_actual&&!i.is_last_version)return;if(only_signed&&!i.eds)return;if(!!only_cosigned&&(!i.date_supplier_eds||!i.date_customer_eds))return;if(i.type_id==type)cnt++});return cnt},checkUserIsContractor:function(is_contractor){if(!is_contractor)Ext.MessageBox.alert("\u041d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u0430\u0432 \u0434\u043e\u0441\u0442\u0443\u043f\u0430", "\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c, \u0437\u0430\u043c\u0435\u043d\u044f\u0442\u044c \u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b\u044b \u043c\u043e\u0433\u0443\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u0441 \u043f\u0440\u0438\u0432\u0438\u043b\u0435\u0433\u0438\u0435\u0439 \u00ab\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0443\u043f\u043e\u043b\u043d\u043e\u043c\u043e\u0447\u0435\u043d\u043d\u044b\u0439 \u043d\u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430\u00bb"); return!!is_contractor},showSupplierInfoDialog:function(supplier,additional_suppliers){var items=[];var fields={full_name:"\u041f\u043e\u043b\u043d\u043e\u0435 \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438:",inn:"\u0418\u041d\u041d:",kpp:"\u041a\u041f\u041f:",address_main:"\u042e\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u0434\u0440\u0435\u0441:",address_post:"\u041f\u043e\u0447\u0442\u043e\u0432\u044b\u0439 \u0430\u0434\u0440\u0435\u0441:", phone:"\u041a\u043e\u043d\u0442\u0430\u043a\u0442\u043d\u044b\u0439 \u0442\u0435\u043b\u0435\u0444\u043e\u043d:",bank:"\u0411\u0430\u043d\u043a\u043e\u0432\u0441\u043a\u0438\u0435 \u0440\u0435\u043a\u0432\u0438\u0437\u0438\u0442\u044b:",account_ras:"\u0420\u0430\u0441\u0447\u0435\u0442\u043d\u044b\u0439 \u0441\u0447\u0435\u0442:",account_cor:"\u041a\u043e\u0440\u0440. \u0441\u0447\u0435\u0442:"};items.push({xtype:"Application.components.keyValuePanel",border:false,margin:0,padding:0,fields:fields, values:supplier});if(!additional_suppliers||additional_suppliers.length==0)additional_suppliers=supplier.additional_suppliers;if(additional_suppliers&&additional_suppliers.length>0)Ext.iterate(additional_suppliers,function(additional_supplier){items.push({html:"
      "});items.push({xtype:"Application.components.keyValuePanel",border:false,margin:0,padding:0,fields:fields,values:additional_supplier})});var orgWindow=new Ext.Window({autoHeight:true,width:600,title:"\u0420\u0435\u043a\u0432\u0438\u0437\u0438\u0442\u044b \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430", constrain:true,modal:true,items:[{xtype:"panel",width:"100%",autoHeight:true,autoScroll:true,frame:true,items:items}],buttonAlign:"right",buttons:[{text:"\u0417\u0430\u043a\u0440\u044b\u0442\u044c",handler:function(){orgWindow.close()}}]});orgWindow.show()},showSupplierRecs:function(supplier_id,suppliers,additional_suppliers){var supplier=this.findRecordById(supplier_id,suppliers);this.showSupplierInfoDialog(supplier,additional_suppliers)},renderInfo:function(title,value){return'
      '+ title+": "+value+"
      "},renderLotInfo:function(params,currentContract,mode){var lot=params.lot;var customers=params.customers;var suppliers=params.suppliers;var current_customer=params.current_customer;var current_supplier=params.current_supplier;var currency=params.currency;var url="com/contract/index/lot/"+lot.id;var renderInfo=this.renderInfo;var currentContract=currentContract||{};var infos={registry_number:"\u0420\u0435\u0435\u0441\u0442\u0440\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b", title:"\u041d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043b\u043e\u0442\u0430",price:"\u041d\u0430\u0447\u0430\u043b\u044c\u043d\u0430\u044f (\u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f) \u0446\u0435\u043d\u0430 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"};var templates={price:new Ext.XTemplate(''+"{[Ext.util.Format.formatPrice(values.price)]} "+renderCurrencySign(currency.name)+""),commodity_price:new Ext.XTemplate(''+ "{[Ext.util.Format.formatPrice(values.commodity_price)]} "+renderCurrencySign(currency.name)+""),final_price:new Ext.XTemplate(''+"{[Ext.util.Format.formatPrice(values.final_price)]} "+renderCurrencySign(currency.name)+"")};var values={};var i;var t;var winner=this.findRecordById(lot.winner_id,suppliers);var tmp_registry_number=lot.registry_number;lot.registry_number=lot.registry_number+", \u043b\u043e\u0442 \u2116 "+lot.number;for(i in infos){if(!infos.hasOwnProperty(i))continue; values[i]=lot[i]}lot.registry_number=tmp_registry_number;if(params.lot.price_form==PRICE_FORM_UNIT_PRICE_AND_MAX_CONTRACT_PRICE){infos.commodity_price="\u0426\u0435\u043d\u0430 \u0442\u043e\u0432\u0430\u0440\u0430, \u0440\u0430\u0431\u043e\u0442\u044b, \u0443\u0441\u043b\u0443\u0433\u0438";values.commodity_price=params.lot.commodity_price}infos.customer="\u0417\u0430\u043a\u0430\u0437\u0447\u0438\u043a";values.customer=this.renderCustomer(current_customer,customers);if(winner){infos.winner="\u0417\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044c, \u043f\u0440\u0438\u0437\u043d\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u0431\u0435\u0434\u0438\u0442\u0435\u043b\u0435\u043c \u0432 \u0442\u043e\u0440\u0433\u0430\u0445 \u043f\u043e \u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u043b\u043e\u0442\u0443"; values.winner=this.renderSupplier(winner.id,suppliers);if(!!winner["preference925_applied"])infos.final_price="\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0446\u0435\u043d\u043e\u0432\u043e\u0435 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043f\u043e\u0434\u0430\u043d\u043d\u043e\u0435 \u043f\u043e\u0431\u0435\u0434\u0438\u0442\u0435\u043b\u0435\u043c \u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442\u0430 (\u041f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u041f\u0440\u0430\u0432\u0438\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430 \u0420\u0424 \u043e\u0442 16 \u0441\u0435\u043d\u0442\u044f\u0431\u0440\u044f 2016 \u0433. \u2116925)"; else infos.final_price="\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0446\u0435\u043d\u043e\u0432\u043e\u0435 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043f\u043e\u0434\u0430\u043d\u043d\u043e\u0435 \u043f\u043e\u0431\u0435\u0434\u0438\u0442\u0435\u043b\u0435\u043c";values.final_price=winner.price||lot.start_price}else if(params.lot.winner_id&¶ms.lot.final_price){infos.final_price="\u0426\u0435\u043d\u0430 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"; values.final_price=params.lot.final_price}infos.guarantee_contract="\u0422\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430";values.guarantee_contract=lot.guarantee_needed?"\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e":"\u043d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e"; if(lot["many_participants"]){infos.winner=undefined;infos.final_price=undefined;values.winner=undefined;values.final_price=undefined;infos.contract_participants="\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u0441 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430\u043c\u0438";var contractParticipants=[];Ext.each(suppliers,function(v){if(v.contract_applied)contractParticipants.push(v.short_name)});values.contract_participants=contractParticipants.join(", ")}else infos.contract_participants= undefined;if(null!==params.agreement_required&&undefined!==params.agreement_required){infos.agreement_required="\u041f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430";values.agreement_required=params.agreement_required?"\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f":"\u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f"}var contract_types={0:"\u043d\u0435 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f", 1:"\u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u0435",2:"\u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u043f\u0438\u0441\u044c\u043c\u0435\u043d\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u0435"};if(null!==params.signature_required&&undefined!==params.signature_required){infos.signature_required="\u0414\u043e\u0433\u043e\u0432\u043e\u0440";values.signature_required= contract_types[params.signature_required]||"?"}if(!!currentContract["customerSigned"]&&!!currentContract["supplierSigned"]||!!currentContract&¶ms.signature_required===2){infos.addnumber="\u041d\u043e\u043c\u0435\u0440 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430";values.addnumber={xtype:"Application.components.ContractNumberPanel",contractInfo:currentContract,value:currentContract["registration_number"],editable:currentContract["customer_id"]==Main.contragent.id}}var info={xtype:"Application.components.keyValuePanel", title:"\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u043b\u043e\u0442\u0435",anchor:"100%",autoHeight:true,fields:infos,templates:templates,values:values,style:"margin: 5px 5px 0px",defaults:{xtype:"panel"}};return info},renderParticipants:function(params){var lot=params.lot;var customers=params.customers;var suppliers=params.suppliers;var current_customer=params.current_customer;var current_supplier=params.current_supplier;var currency=params.currency;var url="com/contract/index/lot/"+ lot.id;var i,str,info=[];var suppliers_store=[];var renderInfo=this.renderInfo;var t;for(i=0;i0)str+="("+additional_suppliers_array.join(", ")+ ")";str+=" ("+Ext.util.Format.formatPrice(t.price||lot.start_price);if(t.pref_price&&t.price!=t.pref_price)str+="/"+Ext.util.Format.formatPrice(t.pref_price);str+=" "+renderCurrencySign(currency.name)+")";suppliers_store.push([t.id,str,t.position||999])}var customers_store=[];for(i=0;i0)info.push(renderSelector({title:"\u0417\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u0438 \u043f\u043e \u043b\u043e\u0442\u0443"+this.renderTip("\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430 \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u0430 \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u0445\u0441\u044f \u043a \u043d\u0435\u043c\u0443"), store:customers_store,value:current_customer,handler:function(combo,record){if(record.data.field1==current_customer)return;Application.models.Contract.redirectToContract(record.data.field1,current_supplier,url)}}));if(suppliers_store.length>0)info.push(renderSelector({title:"\u0423\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0438 \u0442\u043e\u0440\u0433\u043e\u0432, \u0434\u043e\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0435 \u043a \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044e \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"+ this.renderTip("\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430 \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u0445\u0441\u044f \u043a \u043d\u0435\u043c\u0443"),store:suppliers_store,value:current_supplier,handler:function(combo,record){if(record.data.field1== current_supplier)return;Application.models.Contract.redirectToContract(current_customer,record.data.field1,url)}}));else if(!!params.lot.contract_supplier_id)info.push({xtype:"Application.components.keyValuePanel",border:false,margin:0,padding:0,style:"padding: 0",fields:{full_name:"\u0423\u0447\u0430\u0441\u0442\u043d\u0438\u043a \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u0431\u0435\u0434\u0438\u0442\u0435\u043b\u0435\u043c \u043f\u043e \u043b\u043e\u0442\u0443"},values:{full_name:params.current_supplier_info.full_name}}); else{info.push({xtype:"fieldset",frame:false,hidden:params["signature_required"]!=null,items:[{html:"\u041e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u043d\u044f\u0442\u0438\u0435 \u0444\u043e\u0440\u043c\u044b \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430",style:"text-align:center",border:false}]});info.push({xtype:"fieldset",title:"\u0417\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044c",hidden:params["signature_required"]== null,frame:false,items:[{xtype:"Application.components.SupplierInputPanel",allowNotRegistered:params["signature_required"]==2,hide_profile_type:true,additionalItems:[{xtype:"fieldset",border:false,items:[{xtype:"Application.components.priceField",name:"final_price",fieldLabel:"\u0426\u0435\u043d\u0430 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430"+REQUIRED_FIELD},{xtype:"hidden",name:"lot_id",value:params.lot.id}]}],useHandler:true,handler:function(button){var cmp=button.scope;var values={};collectComponentValues(cmp, values);if(!values["inn"]||!values["full_name"]||!values["final_price"]){Ext.MessageBox.alert("\u041e\u0448\u0438\u0431\u043a\u0430","\u0417\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u0432\u0441\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044f");return}performRPCCall(RPC.Contract.assignContractSupplier,[values],[],function(resp){echoResponseMessage(resp);if(resp.success)window.location.reload(true)})}}]})}return info},showContractEds:function(eds_text){var edsWin= new Ext.Window({autoHeight:true,width:600,title:"\u0414\u0430\u043d\u043d\u044b\u0435 "+t("\u042d\u0426\u041f"),constrain:true,modal:true,items:[{xtype:"panel",width:"100%",border:false,autoHeight:true,frame:true,bodyCssClass:"subpanel-top-padding",items:[{width:"99%",height:350,xtype:"textarea",readOnly:true,value:eds_text}]}],buttonAlign:"center",buttons:[{text:"\u0417\u0430\u043a\u0440\u044b\u0442\u044c",handler:function(){edsWin.close()}}]});edsWin.show()},showEdsInfo:function(eds_text){var edsWin= new Ext.Window({autoHeight:true,width:600,title:"\u0414\u0430\u043d\u043d\u044b\u0435 "+t("\u042d\u0426\u041f"),constrain:true,modal:true,items:[{xtype:"panel",width:"100%",border:false,autoHeight:true,frame:true,bodyCssClass:"subpanel-top-padding",html:eds_text}],buttonAlign:"center",buttons:[{text:"\u0417\u0430\u043a\u0440\u044b\u0442\u044c",handler:function(){edsWin.close()}}]});edsWin.show()}});Ext.onReady(function(){Application.models.Contract=new Application.models.ContractClass});Ext.define("Application.models.GridButtons",{extend:"Ext.util.Observable",actions:[],module:"com",childactions:[],component:null,constructor:function(component){this.component=component;var cmp=this.component;this.actions=this.setComActions(cmp);this.childactions=this.setChildActions(cmp);this.addActions();Application.models.GridButtons.superclass.constructor.call(this,component)},setComActions:function(cmp){var Status=Application.models.Procedure.statuses;return{procedure_monitoring:[{tooltip:"\u041c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433", icon:"/ico/procedures/e_auctions.png",lotDepends:true,scope:"item",isHiddenInLot:function(r,l){return Status.trade!=l.status},isHidden:cmp.isAllOf,handler:this.lotActionHandler("com/procedure/trade/lot/{lot_id}/procedure/{procedure_id}"),lotHref:"com/procedure/trade/lot/{lot_id}/procedure/{procedure_id}"}],procedure_representatives:[{tooltip:"\u041f\u043e\u0434\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u044f\u0432\u043a\u0438",icon:"/ico/applics/applications.png",lotDepends:true,scope:"item",isHidden:cmp.isAllOf, isHiddenInLot:function(r,l){var hidden=true;if(l.statusStatus.published||r.data.oos_publish_status== 1||r.data.oos_changes_status==1||r.data.frm=="peretorg";if(r.data.organizer_contragent_id==Main.contragent.id&&val!=Status.archive&&!!r.data["extended_edit"])return false;if(r.data.organizer_contragent_id==Main.contragent.id&&(r.data.oos_publish_status==1||r.data.oos_changes_status==1))hide=false;if([PROCEDURE_TYPE_AUC_ASC,PROCEDURE_TYPE_AUC_DESC,PROCEDURE_TYPE_TENDER,PROCEDURE_TYPE_PRICELIST_REQ].indexOf(r.data.procedure_type)>-1&&r.data.organizer_contragent_id==Main.contragent.id&&(previous_val== Status.published&&val!=Status.final_registration)&&!!r.get("has_first_parts_discussion"))hide=false;if(r.data.organizer_contragent_id==Main.contragent.id&&val==Status.added)hide=false;return hide},text:"",href:hrefAction(this.module+"/procedure/edit/id/{id}")},{tooltip:"\u041f\u0440\u043e\u0434\u043b\u0435\u043d\u0438\u0435 \u0441\u0440\u043e\u043a\u0430",icon:"/ico/cron.png",lotDepends:true,scope:"item",isHidden:cmp.isAllOf,isHiddenInLot:function(r,l){if(Main.contragent&&r.data.organizer_contragent_id== Main.contragent.id&&(Main.config.prolongate_enabled&&Main.config.prolongate_enabled==true)&&l.can_prolongate)return false;return true},handler:this.lotActionHandler("com/procedure/prolongate/lot/{lot_id}/procedure/{procedure_id}"),lotHref:"com/procedure/prolongate/lot/{lot_id}/procedure/{procedure_id}"},{tooltip:Main.contragent&&isCustomer()?"\u041e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f, \u043d\u0435 \u0434\u043e\u0436\u0438\u0434\u0430\u044f\u0441\u044c \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f \u0415\u0418\u0421": "\u041e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u0442\u044c, \u043d\u0435 \u0434\u043e\u0436\u0438\u0434\u0430\u044f\u0441\u044c \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f \u0415\u0418\u0421",icon:"/ico/sign.png",isHidden:function(v,m,r){var val=calculateStatusNumber("status",r);if(Main.config.disable_remote_edit&&r.data.remote_id)return true;if(isAdmin()&&(r.data.oos_changes_status==1||r.data.oos_publish_status==1))return false;if(Main.config.allow_customer_publish){if(isCustomer()&& r.data.organizer_contragent_id==Main.contragent.id&&r.data.oos_changes_status==1){var last_update=null;if(!Ext.isEmpty(r.data.date_last_update)){last_update=r.data.date_last_update;if(last_update)last_update=last_update.format("d.m.Y")}var cur_date=new Date;cur_date=cur_date.format("d.m.Y");if(last_update==cur_date)return true;return false}return true}return!isAdmin()||val>Status.signed},text:"",scope:this,handler:function(grid,rowIndex){cmp.showRegnumForm(grid.getAt(rowIndex),grid,isCustomer())}}, {tooltip:"\u041f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c \u0438 \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u0442\u044c",icon:"/ico/sign.png",isHidden:function(v,m,r){if(!Main.config.disable_remote_edit||!r.data.remote_id||!isCustomer()||r.data.organizer_contragent_id!=Main.contragent.id)return true;var val=calculateStatusNumber("status",r);if(val==Status.published&&r.data.modified)return false;return val>=Status.signed},text:"",href:hrefAction("com/procedure/sign/procedure/{id}")}, {tooltip:"\u041f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0438\u0437\u0432\u0435\u0449\u0435\u043d\u0438\u0435 \u043e \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0438 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b",icon:"/ico/applics/announcement.png",pseudo:"view",isHidden:function(v,m,r){var hide=true;var val=calculateStatusNumber("status",r);if(val>1)return!hide;if(val==1&&!!r.get("send_to_oos"))return!hide;return hide},text:"",href:hrefAction("com/procedure/view/procedure/{id}")}, {tooltip:"\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u0438\u0437\u0431\u0440\u0430\u043d\u043d\u043e\u0435",icon:"/ico/procedures/selected_procedures.png",pseudo:"favourize",isHidden:function(v,m,r){return isEmpty(Main.contragent)||parseInt(r.data.favourite)||isAdmin()?true:false},handler:function(grid,rowIndex){var item=grid.getAt(rowIndex);var params={};params.procedure_id=item.id;performRPCCall(RPC.Procedure.favourize,[params],null,function(result){grid.store.reload();echoResponseMessage(result)})}}, {tooltip:"\u041f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f \u0447\u0435\u0440\u0435\u0437 Telegram",icon:"/ico/telegram.png",pseudo:"favourize",isHidden:function(v,m,r){return isEmpty(Main.contragent)||!Main.user.notify_telegram||parseInt(r.data.favourite_telegram)||isAdmin()?true:false},handler:function(grid,rowIndex){var item=grid.getAt(rowIndex);var params={};params.procedure_id=item.id;params.notify_telegram=true;performRPCCall(RPC.Procedure.favourize, [params],null,function(result){grid.store.reload();echoResponseMessage(result)})}},{tooltip:"\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0438\u0437 \u0438\u0437\u0431\u0440\u0430\u043d\u043d\u043e\u0433\u043e",icon:"/ico/procedures/delete_procedure.png",pseudo:"unfavourize",isHidden:function(v,m,r){return isEmpty(Main.contragent)||!parseInt(r.data.favourite)||isAdmin()?true:false},handler:function(grid,rowIndex){var item=grid.getAt(rowIndex);var params={};params.procedure_id=item.id;performRPCCall(RPC.Procedure.unfavourize, [params],null,function(result){grid.store.reload();echoResponseMessage(result)})}},{tooltip:"\u0423\u0431\u0440\u0430\u0442\u044c \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f \u0447\u0435\u0440\u0435\u0437 Telegram",icon:"/ico/delete-telegram.png",pseudo:"unfavourize",isHidden:function(v,m,r){return isEmpty(Main.contragent)||!Main.user.notify_telegram||!parseInt(r.data.favourite_telegram)||isAdmin()?true:false},handler:function(grid,rowIndex){var item=grid.getAt(rowIndex);var params= {};params.procedure_id=item.id;params.notify_telegram=true;performRPCCall(RPC.Procedure.unfavourize,[params],null,function(result){grid.store.reload();echoResponseMessage(result)})}},{tooltip:"\u0412\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u0415\u0418\u0421",icon:"/ico/oos.png",isHidden:function(v,m,r){return Main.contragent&&r.data.send_to_oos&&r.data.organizer_contragent_id==Main.contragent.id||r.data.send_to_oos&&isAdmin()?false:true},scope:this,handler:function(grid, rowIndex){cmp.showOOSEvents(grid.getAt(rowIndex))}},{tooltip:"\u041f\u0435\u0440\u0435\u0444\u043e\u0440\u043c\u0438\u0440\u0432\u043e\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u0432 \u0415\u0418\u0421",icon:"/ico/application.png",isHidden:function(v,m,r){return!isAdmin()||!r.data.send_to_oos||r.data.oos_publish_status==null},scope:this,handler:function(grid,rowIndex){var confirm=new Ext.Template("\u0412\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u0435\u0440\u0435\u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 \u00ab{title}\u00bb?"); var item=grid.getAt(rowIndex);if(item){item=item.data;var display_params={mask:true,wait_text:"\u041f\u0435\u0440\u0435\u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430",confirm:confirm.apply(item)};var params={};params.procedure_id=item.id;performRPCCall(RPC.Procedure.resendoos,[params],display_params,function(result){echoResponseMessage(result)})}}},{tooltip:"\u041f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u0432 \u043d\u0430 \u0415\u0418\u0421", icon:"/images/icons/silk/door_out.png",isHidden:function(v,m,r){var val=calculateStatusNumber("status",r);var allowed=isAdmin();if(!allowed)allowed=isCustomer()&&r.data.organizer_contragent_id==Main.contragent.id;return!allowed||val0&&isButtonVisible(this.pseudo, l.lot_step,r.data.procedure_type,calculateStatusNumber("status",r)))},handler:this.lotActionHandler("com/procedure/requestlist/procedure/{registry_number}"),lotHref:"com/procedure/requestlist/procedure/{registry_number}"},{tooltip:"\u0417\u0430\u043f\u0440\u043e\u0441\u044b \u043d\u0430 \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0437\u0430\u044f\u0432\u043e\u043a \u043d\u0430 \u0443\u0447\u0430\u0441\u0442\u0438\u0435", icon:"/ico/applics/withdraw_applic.png",pseudo:"explain_req_applic_list",lotDepends:true,scope:"item",isHidden:cmp.isAllOf,isHiddenInLot:function(r,l){return!isCustomer()||!isButtonVisible(this.pseudo,l.lot_step,r.data.procedure_type,calculateStatusNumber("status",r))||Main.contragent&&Main.contragent.id!=r.data.organizer_contragent_id||r.data.application_stages==1&&(r.data.procedure_type==Application.models.Procedure.type_ids.auction_up||r.data.procedure_type==Application.models.Procedure.type_ids.auction_down)}, handler:this.lotActionHandler("com/procedure/requestappliclist/procedure/{registry_number}"),lotHref:"com/procedure/requestappliclist/procedure/{registry_number}"},{tooltip:"\u041f\u043e\u0434\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u0438\u0442\u043e\u0433\u043e\u0432 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b",icon:"/ico/message.png",pseudo:"add_result_req",lotDepends:true,scope:"item",isHidden:cmp.isAllOf, isHiddenInLot:function(r,l){var hidden=!(isSupplier()&&(r.data.is_second_part_applicant||!!r.data.is_application_additional_supplier)&&(isButtonVisible(this.pseudo,l.lot_step,r.data.procedure_type,calculateStatusNumber("status",r))||l.status==Status.archive))||Main.contragent&&r.data.organizer_contragent_id==Main.contragent.id||l.status>Status.archive;return hidden},handler:this.lotActionHandler("com/procedure/requestresult/type/request/procedure/{procedure_id}/lot/{lot_id}/message_type/1"),lotHref:"com/procedure/requestresult/type/request/procedure/{procedure_id}/lot/{lot_id}/message_type/1"}, {tooltip:"\u041f\u043e\u0434\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u0438\u0442\u043e\u0433\u043e\u0432 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u0442\u0431\u043e\u0440\u0430",icon:"/ico/message5.png",pseudo:"add_pre_result_req",lotDepends:true,scope:"item",isHidden:cmp.isAllOf,isHiddenInLot:function(r,l){var visible=isSupplier()&&(!!r.data.is_applicant|| !!r.data.is_rejected_applicant||!!r.data.is_application_additional_supplier)&&(r.data.procedure_type==Application.models.Procedure.type_ids.paper_contest_in_two_steps||r.data.procedure_type==Application.models.Procedure.type_ids.contest_in_two_steps)&&in_array(l.lot_step,[null,"correction","procedure_correction","applic_opened","first_parts","second_parts"]);return!visible},handler:this.lotActionHandler("com/procedure/requestresult/type/request/procedure/{procedure_id}/lot/{lot_id}/message_type/2"), lotHref:"com/procedure/requestresult/type/request/procedure/{procedure_id}/lot/{lot_id}/message_type/2"},{tooltip:"\u041f\u043e\u0434\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u043a\u0443\u0440\u0441\u043d\u044b\u0445 \u0437\u0430\u044f\u0432\u043e\u043a", icon:"/ico/message4.png",pseudo:"add_contests_app_results_req",lotDepends:true,scope:"item",isHidden:cmp.isAllOf,isHiddenInLot:function(r,l){var hidden=!(isSupplier()&&(r.data.is_any_applicant||!!r.data.is_application_additional_supplier)&&isButtonVisible(this.pseudo,l.lot_step,r.data.procedure_type,calculateStatusNumber("status",r))&&calculateStatusNumber("status",r)!=Status.final_registration&&[Application.models.Procedure.type_ids.contest,Application.models.Procedure.type_ids.paper_contest,Application.models.Procedure.type_ids.paper_contest_in_two_steps, Application.models.Procedure.type_ids.contest_in_two_steps].indexOf(r.data.procedure_type)>-1)||Main.contragent&&r.data.organizer_contragent_id==Main.contragent.id;return hidden},handler:this.lotActionHandler("com/procedure/requestresult/type/request/procedure/{procedure_id}/lot/{lot_id}/message_type/3"),lotHref:"com/procedure/requestresult/type/request/procedure/{procedure_id}/lot/{lot_id}/message_type/3"},{tooltip:"\u0420\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f \u0438\u0442\u043e\u0433\u043e\u0432 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b", icon:"/ico/message.png",pseudo:"result_req_list",lotDepends:true,scope:"item",isHidden:cmp.isAllOf,isHiddenInLot:function(r,l){return!(isCustomer()&&r.data.organizer_contragent_id==Main.contragent.id&&r.data.request_result_number>0&&(isButtonVisible(this.pseudo,l.lot_step,r.data.procedure_type,calculateStatusNumber("status",r))||l.status==8))},handler:this.lotActionHandler("com/procedure/requestresultlist/procedure/{registry_number}"),lotHref:"com/procedure/requestresultlist/procedure/{registry_number}"}, {tooltip:"\u041f\u043e\u0434\u0430\u0447\u0430 \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u043e\u0431 \u0443\u0447\u0430\u0441\u0442\u0438\u0438",icon:"/ico/applics/edit_applic.png",lotDepends:true,scope:"item",isHiddenInLot:function(r,l){return!isSupplierAccred()||Main&&Main.contragent&&Main.contragent.id==r.data.organizer_contragent_id||l.status!=2||r.data.procedure_type!=PROCEDURE_TYPE_QUOTATION_REQ||l.has_intention||!Main.config.intentions},isHidden:cmp.isAllOf,handler:this.lotActionHandler("com/applic/makeintention/lot/{lot_id}/procedure/{procedure_id}"), lotHref:"com/applic/makeintention/lot/{lot_id}/procedure/{procedure_id}"},{tooltip:"\u0417\u0430\u044f\u0432\u043a\u0430 \u043d\u0430 \u0443\u0447\u0430\u0441\u0442\u0438\u0435",icon:"/ico/applics/create_applic.png",pseudo:"apply",lotDepends:true,scope:"item",isHiddenInLot:function(r,l){var hidden=true;if(!isSupplier()||Main.contragent.id==r.data.organizer_contragent_id)return hidden;if(l.customer_ids&&in_array(Main.contragent.id,l.customer_ids))return hidden;if(Main.config.intentions&&r.data.procedure_type== PROCEDURE_TYPE_QUOTATION_REQ&&!l.has_intention)return hidden;if(Application.models.Procedure.groups.paper_forms.indexOf(r.data.procedure_type)>=0)return hidden;if(!isEmpty(r.get("frm"))&&r.get("is_applicant")!==true)return hidden;if((r.data.procedure_type==Application.models.Procedure.type_ids.auction_up||r.data.procedure_type==Application.models.Procedure.type_ids.auction_down||r.data.procedure_type==Application.models.Procedure.type_ids.peretorg_reduc)&&l.status==Status.add_price_registration)return true; if(r.get("is_application_additional_supplier")==true)this.tooltip="\u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044c \u0437\u0430\u044f\u0432\u043a\u0443 \u043d\u0430 \u0443\u0447\u0430\u0441\u0442\u0438\u0435";if(l.status==Status.paused&&l.lot_step=="edit")return!hidden;else if(l.status!=Status.published&&l.status!=Status.app_discussion&&(r.get("is_active_applicant")!==true&&r.get("is_application_additional_supplier")!==true||[Status.add_price_registration,Status.final_registration].indexOf(l.status)< 0))return hidden;return false},isHidden:cmp.isAllOf,handler:this.lotActionHandler("com/applic/create/lot/{lot_id}/procedure/{procedure_id}/additional/{is_application_additional_supplier}"),lotHref:"com/applic/create/lot/{lot_id}/procedure/{procedure_id}/additional/{is_application_additional_supplier}"},{tooltip:"\u0421\u0442\u0430\u0442\u0443\u0441 \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u0437\u0430\u044f\u0432\u043a\u0438 \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u0430\u043c\u0438", icon:"/images/icons/silk/application_form_magnify.png",pseudo:"additional_suppliers",scope:"item",lotDepends:true,isHiddenInLot:function(r,l){var hidden=true;if(Main.config.extended_applic_registration_quotation)if([2,3,4,6,Status.final_registration,Status.add_price_registration].indexOf(l.status)<0)return hidden;else if([3,4,6,Status.final_registration,Status.add_price_registration].indexOf(l.status)>=0&&!l.has_published_application)return hidden;else{if(false===l.extended_applic_registration)return hidden}else if([2, Status.final_registration,Status.add_price_registration].indexOf(l.status)<0)return hidden;if(!isSupplier()||Main.contragent.id==r.data.organizer_contragent_id)return hidden;if(Main.config.intentions&&r.data.procedure_type==PROCEDURE_TYPE_QUOTATION_REQ&&!l.has_intention)return hidden;if(Application.models.Procedure.groups.paper_forms.indexOf(r.data.procedure_type)>=0)return hidden;if(r.data.is_application_has_additional_suppliers&&r.data.is_active_applicant||r.data.is_application_additional_supplier)return!hidden; return hidden},isHidden:cmp.isAllOf,handler:function(grid,rowIndex,colIndex,item,e,lot){var data,location,i;var item=grid.getAt(rowIndex);if(!item||!item.data||!item.data.lots||!item.data.lots.length)return;return grid.showAdditionalSuppliersStatus(item,lot||0)}},{tooltip:"\u0420\u0430\u0437\u043e\u0441\u043b\u0430\u0442\u044c \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f",icon:"/ico/mail.png",pseudo:"invite",isHidden:function(v,m,r){if(!isAdmin())return true;if(!Main.config.categories_table)return true; if(!r.data.lots||!r.data.lots.length)return true;for(var i=0;iStatus.archive||l.lot_step==LOT_STEP_PREQUALIFICATION||!(r.data.procedure_type==Application.models.Procedure.type_ids.auction_up||r.data.procedure_type==Application.models.Procedure.type_ids.auction_down||r.data.procedure_type==Application.models.Procedure.type_ids.peretorg_reduc))return true;else{if(l.is_peretorg)this.tooltip="\u0425\u043e\u0434 \u043f\u0435\u0440\u0435\u0442\u043e\u0440\u0436\u043a\u0438"; else this.tooltip="\u0425\u043e\u0434 \u0442\u043e\u0440\u0433\u043e\u0432";return false}},handler:function(grid,rowIndex,colIndex,gitem,e,lot){var item=grid.getAt(rowIndex);if(!item||!item.data||!item.data.lots||!item.data.lots.length)return;if(1==item.data.lots.length||undefined!==lot){if(!lot)lot=0;cmp.showOffers(item,lot)}else cmp.expander.expandRow(rowIndex)}},{tooltip:"\u041f\u043e\u0434\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u044f\u0432\u043a\u0438",icon:"/ico/applics/applications.png", pseudo:"applic_list",lotDepends:true,scope:"item",isHidden:cmp.isAllOf,isHiddenInLot:function(r,l){var hidden=true;if(r.data.procedure_type==Application.models.Procedure.type_ids.paper_single_supplier)return hidden;if(Application.models.Procedure.groups.paper_forms.indexOf(r.data.procedure_type)>=0){if((l.status==Application.models.Procedure.statuses.contract||l.status==Application.models.Procedure.statuses.archive)&&(isAdmin()||isCustomer()&&r.data.organizer_contragent_id==Main.contragent.id||!!l["customer_extra_rights"]))return!hidden; if(isAdmin()){if(!Main.config.paper_applic_correction_allowed_steps[l.lot_step])return hidden;return-1===Main.config.paper_applic_correction_allowed_steps[l.lot_step].indexOf(r.data.procedure_type)}return hidden}if(!isAdmin())if(Main.contragent&&(r.data.organizer_contragent_id==Main.contragent.id||!!l["customer_extra_rights"])){if(r.data.procedure_type==PROCEDURE_TYPE_PRICELIST&&l.status==Application.models.Procedure.statuses.published)return!hidden;if((l.statusApplication.models.Procedure.statuses.final_registration||l.status==Application.models.Procedure.statuses.trade)&&l["lot_step"]!="correction")return hidden}else return hidden;else if((l.statusApplication.models.Procedure.statuses.final_registration)&&l["lot_step"]!="correction")return hidden;return!hidden},handler:this.lotActionHandler("com/applic/viewapplics/lot/{lot_id}"),lotHref:"com/applic/viewapplics/lot/{lot_id}"},{tooltip:"\u0416\u0443\u0440\u043d\u0430\u043b \u0434\u043e\u0441\u0442\u0443\u043f\u0430", icon:"/ico/log.png",lotDepends:true,scope:"item",isHiddenInLot:function(r,l){if(l.show_journal===true)return false;if(Main&&Main.config&&Main.config.procedure_access_log&&Main.contragent&&r.data.organizer_contragent_id==Main.contragent.id)return false;return!isAdmin()},isHidden:cmp.isAllOf,handler:function(grid,rowIndex,colIndex,gitem,e,lot){var item=grid.getAt(rowIndex);if(!item||!item.data||!item.data.lots||!item.data.lots.length)return;if(1==item.data.lots.length||undefined!==lot){if(!lot)lot= 0;cmp.showProcedureAccess(item,lot)}else cmp.expander.expandRow(rowIndex)}},{tooltip:"\u041f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u044b",icon:"/ico/document.png",pseudo:"protocol_list",lotDepends:true,scope:"item",isHiddenInLot:function(r,l){var status=calculateStatusNumber("status",r);if(r.data.procedure_type==PROCEDURE_TYPE_PRICELIST&&!isAdmin())return true;if(status==Application.models.Procedure.statuses.archive)return false;if(status==Application.models.Procedure.statuses.second_parts)return false; if(status==Application.models.Procedure.statuses.contract)return false;if(status==Application.models.Procedure.statuses.add_price_registration)return false;if(status==Application.models.Procedure.statuses.paused)return false;return!isButtonVisible(this.pseudo,l.lot_step,r.data.procedure_type,status)},isHidden:cmp.isAllOf,handler:this.lotActionHandler("com/protocol/index/lot/{lot_id}"),lotHref:"com/protocol/index/lot/{lot_id}"},{tooltip:"\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c (\u043f\u0435\u0440\u0435\u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c) \u0437\u0430\u044f\u0432\u043a\u0438", icon:"/ico/registry.png",pseudo:"review",lotDepends:true,scope:"item",isHidden:cmp.isAllOf,isHiddenInLot:function(r,l){return!isCustomer()||!(4==l.status||5==l.status)||Main.contragent.id!=r.data.organizer_contragent_id||l.lot_step==LOT_STEP_EVALUATION},handler:this.lotActionHandler("com/applic/review/lot/{lot_id}/stage/1"),lotHref:"com/applic/review/lot/{lot_id}/stage/1"},{tooltip:"\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0430\u0443\u043a\u0446\u0438\u043e\u043d\u0430", icon:"/ico/applics/sign_applic.png",pseudo:"trade_protocol_load",lotDepends:true,scope:"item",isHidden:cmp.isAllOf,isHiddenInLot:function(r,l){return!isCustomer()||6!=l.status&&l.lot_step!=="add_trade"||Main.contragent.id!=r.data.organizer_contragent_id||r.data.procedure_type!=Application.models.Procedure.type_ids.auction_up&&r.data.procedure_type!=Application.models.Procedure.type_ids.auction_down},handler:this.lotActionHandler("com/applic/review/lot/{lot_id}/stage/3"),lotHref:"com/applic/review/lot/{lot_id}/stage/3"}, {tooltip:"\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u0442\u043e\u0440\u0436\u043a\u0438",icon:"/ico/applics/sign_applic.png",pseudo:"peretorg_protocol_load",lotDepends:true,scope:"item",isHidden:cmp.isAllOf,isHiddenInLot:function(r,l){return!isCustomer()||6!=l.status||Main.contragent.id!=r.data.organizer_contragent_id||r.data.procedure_type!=Application.models.Procedure.type_ids.peretorg_reduc}, handler:this.lotActionHandler("com/applic/review/lot/{lot_id}/stage/4"),lotHref:"com/applic/review/lot/{lot_id}/stage/4"},{tooltip:"\u041f\u043e\u0434\u0432\u0435\u0434\u0435\u043d\u0438\u0435 (\u043f\u0435\u0440\u0435\u043f\u043e\u0434\u0432\u0435\u0434\u0435\u043d\u0438\u0435) \u0438\u0442\u043e\u0433\u043e\u0432",icon:"/ico/registry.png",pseudo:"itog",lotDepends:true,scope:"item",isHidden:cmp.isAllOf,isHiddenInLot:function(r,l){return!isCustomer()||!(6==l.status||7==l.status)||Main.contragent.id!= r.data.organizer_contragent_id||l.lot_step==LOT_STEP_PREQUALIFICATION||l.lot_step==LOT_STEP_PREPREQUALIFICATION||r.data.procedure_type==Application.models.Procedure.type_ids.paper_single_supplier||r.data.application_stages==1&&(r.data.procedure_type==Application.models.Procedure.type_ids.auction_up||r.data.procedure_type==Application.models.Procedure.type_ids.auction_down)},handler:this.lotActionHandler("com/applic/review/lot/{lot_id}/stage/2"),lotHref:"com/applic/review/lot/{lot_id}/stage/2"},{tooltip:"\u041f\u043e\u0434\u0432\u0435\u0434\u0435\u043d\u0438\u0435 (\u043f\u0435\u0440\u0435\u043f\u043e\u0434\u0432\u0435\u0434\u0435\u043d\u0438\u0435) \u0438\u0442\u043e\u0433\u043e\u0432", icon:"/ico/registry.png",pseudo:"prequalification_itog",lotDepends:true,scope:"item",isHidden:cmp.isAllOf,isHiddenInLot:function(r,l){return!isCustomer()||!((6==l.status||7==l.status)&&l.lot_step==LOT_STEP_PREQUALIFICATION)||r.data.procedure_type==Application.models.Procedure.type_ids.paper_single_supplier||Main.contragent.id!=r.data.organizer_contragent_id},handler:this.lotActionHandler("com/applic/review/lot/{lot_id}/stage/6"),lotHref:"com/applic/review/lot/{lot_id}/stage/6"},{tooltip:"\u041f\u043e\u0434\u0432\u0435\u0434\u0435\u043d\u0438\u0435 (\u043f\u0435\u0440\u0435\u043f\u043e\u0434\u0432\u0435\u0434\u0435\u043d\u0438\u0435) \u0438\u0442\u043e\u0433\u043e\u0432 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u0442\u0431\u043e\u0440\u0430", icon:"/ico/registry.png",pseudo:"prequalification_itog",lotDepends:true,scope:"item",isHidden:cmp.isAllOf,isHiddenInLot:function(r,l){return!isCustomer()||!((6==l.status||7==l.status)&&l.lot_step==LOT_STEP_PREPREQUALIFICATION)||Main.contragent.id!=r.data.organizer_contragent_id},handler:this.lotActionHandler("com/applic/review/lot/{lot_id}/stage/7"),lotHref:"com/applic/review/lot/{lot_id}/stage/7"},{tooltip:"\u0412\u0441\u043a\u0440\u044b\u0442\u0438\u0435 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u043e\u0432", icon:"/ico/registry.png",pseudo:"pre_open_applics",lotDepends:true,scope:"item",isHiddenInLot:function(r,l){return!isCustomer()||!isButtonVisible(this.pseudo,l.lot_step,r.data.procedure_type,calculateStatusNumber("status",r))||Main.contragent.id!=r.data.organizer_contragent_id||r.data.procedure_type!=Application.models.Procedure.type_ids.contest&&r.data.procedure_type!=Application.models.Procedure.type_ids.quotation&&r.data.procedure_type!=Application.models.Procedure.type_ids.paper_contest&&r.data.procedure_type!= Application.models.Procedure.type_ids.paper_quotation&&r.data.procedure_type!=Application.models.Procedure.type_ids.paper_pricelist&&r.data.procedure_type!=Application.models.Procedure.type_ids.paper_contest_in_two_steps&&r.data.procedure_type!=Application.models.Procedure.type_ids.contest_in_two_steps},isHidden:cmp.isAllOf,handler:this.lotActionHandler("com/applic/openapplics/lot/{lot_id}/stage/8"),lotHref:"com/applic/openapplics/lot/{lot_id}/stage/8"},{tooltip:"\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0438\u0442\u043e\u0433\u043e\u0432", icon:"/ico/registry.png",pseudo:"change_itog",lotDepends:true,scope:"item",isHidden:cmp.isAllOf,isHiddenInLot:function(r,l){return!isCustomer()||!(6==l.status||7==l.status)||Main.contragent.id!=r.data.organizer_contragent_id||l.lot_step==LOT_STEP_PREQUALIFICATION||l.lot_step==LOT_STEP_PREPREQUALIFICATION||!(r.data.application_stages==1&&(r.data.procedure_type==Application.models.Procedure.type_ids.auction_up||r.data.procedure_type==Application.models.Procedure.type_ids.auction_down))},handler:this.lotActionHandler("com/applic/review/lot/{lot_id}/stage/2"), lotHref:"com/applic/review/lot/{lot_id}/stage/2"},{tooltip:"\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u043e \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430",icon:"/ico/contracts/under_conclusion.png",pseudo:"contract_list",lotDepends:true,scope:"item",isHiddenInLot:function(r,l){return l.status!=11||l.procedure_type!=PROCEDURE_TYPE_PAPER_SINGLE_SUPPLIER||!isCustomer()&&l.customer_ids.indexOf(Main.user.contragent_id)<0&&Main.user.contragent_id!= l.contract_supplier_id&&Main.user.contragent_id!=r.data.organizer_contragent_id&&Main.user.contragent_id!=l.winner_id},isHidden:cmp.isAllOf,handler:this.lotActionHandler("com/contract/reason/lot/{lot_id}"),lotHref:"com/contract/reason/lot/{lot_id}"},{tooltip:"\u0414\u043e\u0433\u043e\u0432\u043e\u0440\u044b",icon:"/ico/contracts/contracts.png",pseudo:"contract_list",lotDepends:true,scope:"item",isHiddenInLot:function(r,l){if(Application.models.Procedure.groups.paper_forms.indexOf(r.data.procedure_type)>= 0&&!Main.config.show_contract_button_for_paper)return true;if([7,8].indexOf(l.status)>-1&&r.data["is_application_additional_supplier"])return false;if([7,8].indexOf(l.status)>-1&&r.data["frm"])return true;if(r.data["access_contracts"]===true&&r.data["applics_count"]>0&&[7,8].indexOf(l.status)>-1&&l.winner_id!==null)return false;var contracts_supplier=false;if(!!l.many_participants&&!!l.contract_suppliers&&!!l.contract_suppliers[0]&&l.contract_suppliers[0]["id"]===Main.user.contragent_id)contracts_supplier= true;return!Main.config.contracts_on||l.status<7||l.status==11||l.winner_id===null&&l.procedure_type!==PROCEDURE_TYPE_PAPER_SINGLE_SUPPLIER&&l.procedure_type!==PROCEDURE_TYPE_PRICELIST||[15,9].indexOf(l.status)>-1&&(l.procedure_type==PROCEDURE_TYPE_PAPER_SINGLE_SUPPLIER||l.procedure_type==PROCEDURE_TYPE_PRICELIST)||l.contract_supplier_id==Main.user.contragent_id&&l["contract_form"]==null||!isAdmin()&&l.customer_ids.indexOf(Main.user.contragent_id)<0&&Main.user.contragent_id!=l.contract_supplier_id&& Main.user.contragent_id!=r.data.organizer_contragent_id&&Main.user.contragent_id!=l.winner_id&&!contracts_supplier&&(l.accessable_to_contracts<1||l.accessable_to_contracts==null)&&(l.representative_to_contracts<1||l.accessable_to_contracts==null)||Main.user.role==="guest"||r.data.procedure_type==5&&!Main.config.contracts_after_pricelist||r.data.procedure_type==4&&!Main.config.contracts_after_quotation},isHidden:cmp.isAllOf,handler:function(grid,rowIndex,colIndex,gitem,e,lot){var item=grid.getAt(rowIndex); var lotNo=lot||0;var lotData=item.data.lots[lotNo];var currentContragent=Main.contragent.id;if(lotData.contract_supplier_id===currentContragent){redirect_to("com/contract/index/lot/"+lotData.id+"/supplier/"+currentContragent);return}if(lotData.many_participants&&lotData.contract_suppliers&&lotData.contract_suppliers[0]&&lotData.contract_suppliers[0].id===currentContragent){redirect_to("com/contract/index/lot/"+lotData.id+"/supplier/"+currentContragent);return}redirect_to("com/contract/index/lot/"+ lotData.id);return}},{tooltip:"\u041f\u0430\u043a\u0435\u0442 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430",icon:"/ico/contract.png",pseudo:"pack_of_documents",lotDepends:true,scope:"item",isHiddenInLot:function(r,l){if(l.winner_id===null||Main.user.role==="guest")return true;if([7,8].indexOf(l.status)>-1&&r.data["frm"])return true;var contracts_supplier= false;if(!!l.many_participants&&!!l.contract_suppliers&&!!l.contract_suppliers[0]&&l.contract_suppliers[0]["id"]===Main.user.contragent_id)contracts_supplier=true;if((isAdmin()||l.contract_supplier_id==Main.user.contragent_id&&l["contract_form"]!=null||l.customer_ids&&l.customer_ids.indexOf(Main.user.contragent_id)>-1||r.data.organizer_contragent_id==Main.user.contragent_id||l["contract_additional_suppliers"]&&l.contract_additional_suppliers.indexOf(Main.user.contragent_id)>-1||isCustomer()&&!isSupplier()&& Main.contragent.customer_accreditations[0].profile_id!==2||contracts_supplier||l["is_additional_supplier"])&&(l.status==7||l.status==8))return false;return true},isHidden:cmp.isAllOf,handler:this.lotActionHandler("com/procedure/contractdocuments/lot/{lot_id}")},{tooltip:"\u041f\u0435\u0440\u0435\u0442\u043e\u0440\u0436\u043a\u0430",icon:"/ico/procedures/replay.png",pseudo:"start_peretorg_basic",lotDepends:true,scope:"item",isHiddenInLot:function(r,l){if(r.data.frm=="peretorg")return true;if(Application.models.Procedure.groups.paper_forms.indexOf(r.data.procedure_type)>= 0)return true;if(Main.config.peretorg_available&&Main.contragent&&Main.contragent.id==r.data.organizer_contragent_id){var peretorg_types=[Application.models.Procedure.type_ids.quotation,Application.models.Procedure.type_ids.contest,Application.models.Procedure.type_ids.pricelist];if(Main.config.peretorg_after_pricelist)peretorg_types.push(Application.models.Procedure.type_ids.pricelist);if(l.status==6&&(peretorg_types.indexOf(r.data.procedure_type)>=0||r.data.frm=="peretorg")&&(l.active_applic_count&& l.active_applic_count>1)&&(!Main.config.peretorg_possible_field||Main.config.peretorg_possible_field&&r.data.peretorg_possible))return false;if(l.status==6&&(r.data.procedure_type==Application.models.Procedure.type_ids.quotation||r.data.procedure_type==Application.models.Procedure.type_ids.pricelist||r.data.procedure_type==Application.models.Procedure.type_ids.contest)&&(l.active_applic_count&&l.active_applic_count>=1)&&Main.config.allow_peretorg_with_one_applic&&(!Main.config.peretorg_possible_field|| Main.config.peretorg_possible_field&&r.data.peretorg_possible))return false}return true},isHidden:cmp.isAllOf,handler:this.lotActionHandler("com/procedure/peretorg/procedure_id/{procedure_id}/lot_id/{lot_id}/frm/peretorg","\u0412\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u0442\u043e\u0440\u0436\u043a\u0443 \u043f\u043e \u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u043b\u043e\u0442\u0443?")}, {tooltip:"\u041f\u0435\u0440\u0435\u0442\u043e\u0440\u0436\u043a\u0430",icon:"/ico/procedures/replay.png",pseudo:"start_peretorg_max",lotDepends:true,scope:"item",isHiddenInLot:function(r,l){if(r.data.frm=="peretorg")return true;if(l.status==6&&(r.data.procedure_type==Application.models.Procedure.type_ids.quotation||r.data.procedure_type==Application.models.Procedure.type_ids.pricelist||r.data.procedure_type==Application.models.Procedure.type_ids.contest)&&(l.active_applic_count&&l.active_applic_count== 1)&&Main.config.allow_peretorg_with_one_applic&&(!Main.config.peretorg_possible_field||Main.config.peretorg_possible_field&&r.data.peretorg_possible))return true;if(Main.config.peretorg_available&&Main.contragent&&Main.contragent.id==r.data.organizer_contragent_id){var peretorg_types=[];if(Main.config.peretorg_all)peretorg_types=[Application.models.Procedure.type_ids.auction_down,Application.models.Procedure.type_ids.contest,Application.models.Procedure.type_ids.quotation,Application.models.Procedure.type_ids.pricelist, Application.models.Procedure.type_ids.qualification,Application.models.Procedure.type_ids.peretorg_reduc,Application.models.Procedure.type_ids.peretorg_contest];else{peretorg_types=[Application.models.Procedure.type_ids.quotation,Application.models.Procedure.type_ids.contest];if(Main.config.peretorg_after_pricelist)peretorg_types.push(Application.models.Procedure.type_ids.pricelist)}if(l.status==6&&(peretorg_types.indexOf(r.data.procedure_type)>=0||r.data.frm=="peretorg")&&(l.active_applic_count&& l.active_applic_count<2)&&(!Main.config.peretorg_possible_field||Main.config.peretorg_possible_field&&r.data.peretorg_possible))return false}return true},isHidden:cmp.isAllOf,handler:function(){Ext.Msg.alert("\u041e\u0448\u0438\u0431\u043a\u0430","\u041d\u0435\u043b\u044c\u0437\u044f \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u0442\u043e\u0440\u0436\u043a\u0443 \u0441 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u0432 \u043c\u0435\u043d\u0435\u0435 \u0434\u0432\u0443\u0445")}}, {tooltip:"\u0412\u0435\u0440\u043d\u0443\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 \u043d\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u044d\u0442\u0430\u043f",icon:"/ico/procedures/replay.png",pseudo:"restore",lotDepends:true,scope:"item",isHiddenInLot:function(r,l){return!isAdmin()||l.status<1},isHidden:cmp.isAllOf,handler:this.lotActionHandler("com/procedure/restore/lot/{lot_id}/procedure/{procedure_id}"),lotHref:"com/procedure/restore/lot/{lot_id}/procedure/{procedure_id}"}, {tooltip:"\u0423\u0434\u0430\u043b\u0438\u0442\u044c",icon:"/ico/delete.png",pseudo:"remove",isHidden:function(v,m,r){var val=calculateStatusNumber("status",r);if(isAdmin()){if(!!Main.config.hide_delete_button_for_admin||r.data.lots&&r.data.lots.length&&r.data.frm!="peretorg"&&r.data.frm!="dotorg")return true}else{if(isCustomer())return Main.contragent.id!=r.data.organizer_contragent_id||val>1;return!isAdmin()}return!isAdmin()},handler:function(grid,rowIndex){var confirm=new Ext.Template("\u0412\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 \u00ab{title}\u00bb?"); var item=grid.getAt(rowIndex);if(item){item=item.data;var params={mask:true,wait_text:"\u0423\u0434\u0430\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430",confirm:confirm.apply(item)};performRPCCall(RPC.Procedure["delete"],[item.id],params,function(resp){echoResponseMessage(resp);if(resp.success)grid.store.reload()})}}},{tooltip:"\u041e\u0442\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b", icon:"/ico/stop.png",pseudo:"cancel",lotDepends:true,scope:"item",isHidden:cmp.isAllOf,isHiddenInLot:function(r,l){if(isCustomer())if(Main.config.stop_at_any_step)return Main.contragent.id!=r.data.organizer_contragent_id||l.status>7&&l.status!=9&&l.status!=15;else return Main.contragent.id!=r.data.organizer_contragent_id||l.status>4||r.data.oos_publish_status==1;return true},handler:function(grid,rowIndex,colIndex,gitem,e,lot){var data,location,confirm,i;var item=grid.getAt(rowIndex);if(!item||!item.data|| !item.data.lots||!item.data.lots.length)return;if(undefined!==lot){var cnt=0;for(i=0;i1){location="com/procedure/cancel/id/{procedure_id}/lot/{lot_id}";data={lot_id:item.data.lots[lot].id,procedure_id:item.data.id}}else{location="com/procedure/cancel/id/{procedure_id}";data={procedure_id:item.data.id}}}else{var val=0;for(i=0;iitem.data.lots[i]["status"]||10==item.data.lots[i]["status"]? val:item.data.lots[i]["status"];var checkValErrCancel=Main.config.stop_at_any_step?val>7:val>4;if(checkValErrCancel){Ext.Msg.alert("\u041e\u0448\u0438\u0431\u043a\u0430","\u041e\u0442 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u043b\u043e\u0442\u043e\u0432 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u043d\u0435\u043b\u044c\u0437\u044f \u043e\u0442\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u044d\u0442\u0430\u043f\u0435. \u041e\u0442\u043a\u0430\u0437 \u043e\u0442 \u0432\u0441\u0435\u0439 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u0435\u043d."); return}location="com/procedure/cancel/id/{procedure_id}";data={procedure_id:item.data.id}}var template=new Ext.Template(location);var dst=template.apply(data);confirm="\u0412\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u043e\u0442\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b?";Ext.Msg.confirm("\u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435", confirm,function(r){if("yes"==r)redirect_to(dst)})}},{tooltip:"\u041e\u0442\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 \u043f\u043e \u043f\u0440\u0435\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u044e",icon:"/ico/stop.png",pseudo:"stop",lotDepends:true,scope:"item",isHidden:cmp.isAllOf,isHiddenInLot:function(r,l){if(isAdmin())return l.status!=7;return true},handler:function(grid,rowIndex,colIndex,gitem,e,lot){var data,location,i;var item=grid.getAt(rowIndex); if(!item||!item.data||!item.data.lots||!item.data.lots.length)return;if(undefined!==lot){var cnt=0;for(i=0;i1){location="com/procedure/cancel/id/{procedure_id}/lot/{lot_id}";data={lot_id:item.data.lots[lot].id,procedure_id:item.data.id}}else{location="com/procedure/cancel/id/{procedure_id}";data={procedure_id:item.data.id}}}else{var val=true;for(i=0;i